Re: any ideas why this does not work?



Thanks for the additional information. I tried
If (File.Exists(Server.MapPath("~/Files/testfile.doc")))
where Files is a folder in my project and this works fine for what is above.

When I try it with a path that does exist to a folder on a different
machine, note without a file like
If (File.Exists(Server.MapPath("\\\\ExternalMachineName\\Folder1\\Folder2")))
I get the run time error
Failed to map the path "ExternalMachineName/Folder1/Folder2"

Any ideas, thanks ?


--
Paul G
Software engineer.


"Mark Rae [MVP]" wrote:

"Paul" <Paul@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CE9154B8-F859-4EC1-8B31-8185470B87E6@xxxxxxxxxxxxxxxx

The problem is that there is no file actually called
"~/Files/newfile.doc" -
think about it...

Do you know if there is a way in the code to check if a path is just a
path
or if it is a file with out causing a runtime error?

if (File.Exists(Server.MapPath(".........")))
{
File.Delete(Server.MapPath("............."));
}


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


.