Problem solve Get help with specific problems with your technologies, process and projects.

Problem with UNC paths

I wrote an ASP.NET Web form that attempts to copy a file from one location to another. I am able to copy a file from server A to a different location on server A, but when I try to copy a file from server B to server A, I get an error stating that the file does not exist -- but it really does. Here is an example of the code I am using:

File.Copy(filelocationfilelocation, filelocationnewlocation)
This looks like a problem with UNC paths. You can always check if a file exists (at least for the given path) by using File.Exists. Remember that paths must be fully qualified for remote locations.

Another problem that may arise is security, because by default, unless you're impersonating, the process accessing the files will be the ASP.NET account, and not the logged in user account. This may be causing trouble across the network if you have permissions set on the network share or file.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.