I'm working with an aspx file that's supposed to check on a directory (on the same server the file lives on) to see if a file of a particular name exists. Based on its response, it's either supposed to create a link to that file, or, well, do nothing. The code I'm working from is below:
Try wc_result = web_client.DownloadData(\\server\dir\subdir\filename.pdf) Catch ex As Exception If Left(ex.Message, 6) = "THIS FILE EXISTS" Then link = "<a target='_blank' href='\\server\dir\subdir\filename.pdf'>Here is the file</a>" End If End Try Response.write(link)
If I insert a line to echo back the ex.Message, it tells me "The network path was not found". But, we're talking about the same server?!? I dont' think it's a permissions issue, or else it would have explicitly told me so.
I verified that the file does exist, and that the UNC path was accurate.
If I change the "If Left(ex.Message, 6) = "" criteria to "The ne", so it satisfies the boolean, it does create the "Here is the file" link, which does load the PDF, but the ex.Message still says that the network path is not found.
Any suggestions, please?