ASP.NET HTTPHandler not throwing exception when one is expected
Posted
by josephj1989
on Stack Overflow
See other posts from Stack Overflow
or by josephj1989
Published on 2010-06-17T02:11:48Z
Indexed on
2010/06/17
3:13 UTC
Read the original article
Hit count: 319
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.
© Stack Overflow or respective owner