I used System.IO.File.Exist method to check the file. It works for the local drive, but it doesn't work for the network drive (i.e. N:docshowto.doc). System.IO.File.Copyto also doesn't work for the network drive. It gives me this error message: "Could not find file "N:docshowto.doc."
How can I do this in ASP.NET and C#?
First, you're missing the slashes. You must use "N:\\docshowto.doc" or @"@"N:\docshowto."
Second, you should use UNC paths: @"\\myserver\share\docshowto.doc."
What's more, the network path may be better placed in the application web.config.
This was first published in February 2003