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


.



Relevant Pages

  • Re: visual basic exe not working
    ... counter exceeding 32767, for example, the number of files in a folder and ... >>I have a visual basic exe that was working on older versions of windows ... Now I am using XP and I get a run time error '6' overflow error ...
    (microsoft.public.vb.general.discussion)
  • Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4
    ... I copied the program to this folder. ... I don't seem to be able to copy the window, so I see pretty much what I had before from a dialog that popped up, except it adds: ... Fatal Pyton error: Pystring_InterInPlace: strings only please! ... The rest is about the run time error. ...
    (comp.lang.python)
  • Folder Object .Size fails on root drive
    ... VBSCript run time error: permission denied ... root directory does have a system information folder, ...
    (microsoft.public.scripting.vbscript)
  • Re: Runtime Error! Abnormal Progran Termination
    ... I've been having the runtime error so did as you suggested here & dragged ... COM Add-ins to Tools. ... > the Office\Startup folder or use a COM add-in to integrate their ... >> Message pops up ...
    (microsoft.public.word.application.errors)
  • explorer.exe error application
    ... it only does it when I'm in my pictures folder. ... Runtime Error C++ Runtime Visual Library ... >>I have reinstalled the Windows and set up another user ...
    (microsoft.public.windowsxp.perform_maintain)