Accessing files and folders on remote server in webApplication

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I got this problem for the web application

I try to access folders on a remote server. string[] dirs = Directory.GetDirectories(@"E:\vehicles")
E drive is a map to a network drive. I get the DirectoryNotFoundException. How do I solve the problem or the is another way to write the code

Thank you
 
You need to access the network folder using UNC path. Drive letter is
mapped based on the interactive user (The user that is currently
logged on to the machine). The default of an ASP.NET web application
runs under the "ASPNET" user, which does not have the "E" drive letter
mapped.

For example,

Directory.GetDirectories(@"\\Remote server name\vehicles");

Tommy,
 
What if the remote server need a password and username, what will be the syntax if using the UNC server pat
----- Tommy wrote: ----

You need to access the network folder using UNC path. Drive letter i
mapped based on the interactive user (The user that is currentl
logged on to the machine). The default of an ASP.NET web applicatio
runs under the "ASPNET" user, which does not have the "E" drive lette
mapped

For example,

Directory.GetDirectories(@"\\Remote server name\vehicles")

Tommy

Z0gS said:
Hi
I got this problem for the web application
I try to access folders on a remote server. string[] dirs = Directory.GetDirectories(@"E:\vehicles")
E drive is a map to a network drive. I get the DirectoryNotFoundException. How do I solve the problem or the is another way to write the code
 
Back
Top