jgostomhandle
Programmer
A have a problem of accessing a file on the remote server (not Web server). Here is my code:
‘/APF/ is a vertual directory on the Web server asociated with the folder on the remote not Web server.
sPath = Server.MapPath("/APF/test.txt")
I also tried
sPath = "\\vcomnas2\sys\Extract\test.txt"
I also tried
sPath = "\\vcomnas2/sys/Extract/test.txt"
If File.Exists(sPath) Then
Response.Write("File exists <br>")
Else
Response.Write("File not found <br>")
End If
Dim sw As New StreamReader(sPath)
Response.Write(sw.ReadToEnd() & "<br>")
sw.Close()
This code perfectly works when I run it from Visual Studio. But when I run it from my local Web server or from the Company Web server Response.Write prints on the screen “File not found” and I got ASP message:
Access to ‘\vcomnas2sysExtracttest.txt’ is denied.
Please note that message removed slashes from the path. It is not an Access problem, it just cannot find the file, because when I provide a wrong path it still give me a message “Access to … is denied”. So my question is how should I specify the path on the remote (not Web server) to access a file on this path? Thank you in advance for your help.
John
‘/APF/ is a vertual directory on the Web server asociated with the folder on the remote not Web server.
sPath = Server.MapPath("/APF/test.txt")
I also tried
sPath = "\\vcomnas2\sys\Extract\test.txt"
I also tried
sPath = "\\vcomnas2/sys/Extract/test.txt"
If File.Exists(sPath) Then
Response.Write("File exists <br>")
Else
Response.Write("File not found <br>")
End If
Dim sw As New StreamReader(sPath)
Response.Write(sw.ReadToEnd() & "<br>")
sw.Close()
This code perfectly works when I run it from Visual Studio. But when I run it from my local Web server or from the Company Web server Response.Write prints on the screen “File not found” and I got ASP message:
Access to ‘\vcomnas2sysExtracttest.txt’ is denied.
Please note that message removed slashes from the path. It is not an Access problem, it just cannot find the file, because when I provide a wrong path it still give me a message “Access to … is denied”. So my question is how should I specify the path on the remote (not Web server) to access a file on this path? Thank you in advance for your help.
John