I’m trying to download a file from shared drive to desktop but it keeps throwing an error that its not a virtual path. Here is my code:
if (Directory.Exists(Server.MapPath("M://SharedDrive//" + username)))
{
File.Copy("M://SharedDrive//" + username, "C:\\Documents and Settings\\user\\Desktop\\" + username, true);
}
Are you doing this from in an ASP.NET application? (I’m guessing since you are using
Server.MapPath). Then you have two problems:M:. IIS can only access physical drives, or UNC paths (the latter requires security to be set up correctly).Please explain a bit more detailed what you are trying to achieve if we are to be able to help.