ASP.NET HTTPHandler not throwing exception when one is expected
- by josephj1989
I have an HttpHandler class (implements IHttphandler) where the path defined for the handler in web.config is *.jpg. I am requesting a Jpg image in my page. Within the HTTP Handler I am writing to a file in the filesystem. By mistake I was trying to write to a non existant directory. This should have thrown an exception but the execution simply proceeds.Ofcourse no file is written. But if I give a proper directory the file is written correctly.Is there anything special about HttpHandler Exceptions.
See part of the code
public void ProcessRequest(HttpContext context){
File.WriteAllLines(context.Request.ApplicationPath+@"\"+"resul.log",new string[]{"Entered JPG Handler"});
If I put a breakpoint on the File.WriteAllLines statement and then step over it I can see an exception occurring.