Accessing files and folders on remote server in webApplication

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
 
T

Tommy

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,
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top