Forum Moderators: open
fs.FileExists("readme.txt") will not work,
fs.FileExists("../yourdir/readme.txt") will not work,
But this will.
fs.FileExists("C:\inetpub\wwwroot\yourdir\readme.txt")
So when you use Sever.MapPath you are literally using the easy way to providing a full path to fs.FileExists.
Use this to get the full path as the server sees it:
response.write Server.MapPath("readme.txt")
If the method worked the way you've asked here's what would happen... (psuedo code)
public bool FileExists(string in_relativeFileName)
{
// determine if in_relativeFileName lives in system32
return (bool) if exists relativeFileName in system32? true : false;
}
versus...
public bool FileExists(string in_absoluteFileName)
{
// determine if in_absoluteFileName lives specified location
return (bool) if exists absoluteFileName in specified location? true : false;
}