Error trapping in global.asax

A

Andy

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
 
G

Guest

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/micr...read/thread/7c58ca854363534f/3b10df6edc0d8191
 
A

Andy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top