G
Gabe Moothart
Hello,
In one of my asp.net applications I test the existence of a file, like so:
File.Exists(Server.MapPath("/path/file.jpg")));
This was failing, even though the path returned by Server.MapPath was
clearly present. After some debugging, I discovered that the the asp.net
account didn't have permission to execute File.Exists. Apparently
File.Exists simply returns "false" instead of throwing an exception if
it doesn't have the permissions it needs. This is pretty unintuitive.
Anyway, I would like to add an assert method that ensures I have the
proper permissions so that this does not happen again. How might I go
about doing that?
TIA,
Gabe
In one of my asp.net applications I test the existence of a file, like so:
File.Exists(Server.MapPath("/path/file.jpg")));
This was failing, even though the path returned by Server.MapPath was
clearly present. After some debugging, I discovered that the the asp.net
account didn't have permission to execute File.Exists. Apparently
File.Exists simply returns "false" instead of throwing an exception if
it doesn't have the permissions it needs. This is pretty unintuitive.
Anyway, I would like to add an assert method that ensures I have the
proper permissions so that this does not happen again. How might I go
about doing that?
TIA,
Gabe