Jump to content

Recommended Posts

Posted

"An ASP.NET help thread from W3bbo? This is madness!"

 

Yes, I know....

 

It's been a while since I last did any work in this area in ASP.NET before. So now I'm kinda stuck.

 

I've got an ASP.NET Web Application, and within my Global.asax superclass I've got defined:

 

public class Global : HttpApplication {

 

public Global() {

this.BeginRequest += new EventHandler( Global_BeginRequest );

this.EndRequest += new EventHandler( Global_EndRequest );

this.Error += new EventHandler( Global_Error );

}

 

protected void Global_Error(object sender, EventArgs e) {

 

String path = Server.MapPath("~/Exceptions");

String filepath = System.IO.Path.Combine( path, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff") );

 

Request.SaveAs( filepath + ".http", true );

 

Exception theException = Server.GetLastError();

 

System.IO.File.WriteAllText( filepath + ".ex", theException.ToString(), System.Text.Encoding.UTF8 );

 

}

 

Thing is... Global_Error gets called for stuff like 404s to *.aspx resources, but not when an unhandled exception occurs in my own pages.

 

For instance, in another page, in the Load event, I throw new Exception("foobar", new Exception("baz")); but the Global_Error method isn't called at all.

 

Why is this and how can I correct it?

 

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...