By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,225 Members | 2,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,225 IT Pros & Developers. It's quick & easy.

Error trapping in global.asax

P: n/a
Hi there, I have an asp.net 2 web application with SQL Server 2005 db,
running on IIS6. I have implemented some error trapping in the
global.asax file, along the lines of:

void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();

//write details about the exception to a table in the db etc etc

//clear all errors
Server.ClearError();
Context.ClearError();
}

This all works fine on my development machine, but on our live server
(Windows Server 2003) the routine is not getting called at all. It
does not seem to matter if custom errors are on or off in the
web.config. I also have a routine which uses:

void Session_Start(object sender, EventArgs e)
{
//CODE ...
}

to detect when a user's session has timed out and this is not being
called either.

Incidentally, in my project I do not have a global.asax.cs file, so I
am using the above code in <script runat="server" language="C#"tags
in the global.asax file.

Please help!
Andy

Mar 15 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 15, 10:54 am, "Andy" <a...@iancooke.co.ukwrote:
Hi there, I have an asp.net 2 web application with SQL Server 2005 db,
running on IIS6. I have implemented some error trapping in the
global.asax file, along the lines of:

void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();

//write details about the exception to a table in the db etc etc

//clear all errors
Server.ClearError();
Context.ClearError();

}

This all works fine on my development machine, but on our live server
(Windows Server 2003) the routine is not getting called at all. It
does not seem to matter if custom errors are on or off in the
web.config. I also have a routine which uses:

void Session_Start(object sender, EventArgs e)
{
//CODE ...

}

to detect when a user's session has timed out and this is not being
called either.

Incidentally, in my project I do not have a global.asax.cs file, so I
am using the above code in <script runat="server" language="C#"tags
in the global.asax file.

Please help!
Andy
Maybe this can help
http://groups.google.com/group/micro...10df6edc0d8191

Mar 15 '07 #2

P: n/a
Yes it did help!!!! Thanks so much Alexey. I wasn't including the
PrecompiledApp.config file in the root of the web appplication. I put
it in there, restarted the application and hey presto! Thanks again.

Mar 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.