473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Error trapping in global.asax

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
2 1883
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JP | last post by:
I need to be able to trap errors at the application level. I added this code to the Global.asax file. The code I wrote is supposed to get the last error that was generated and write to the event...
3
by: Pa Ji | last post by:
I just created a simple web application and tried to run it. Getting following...any idea what I'm missing Thanks in advance...
14
by: Roland Hall | last post by:
Since I'm not getting any response from the community, I'm reposting this under my managed account. I've turned my web.config friendly error messages off and it may be easier to view what I'm...
1
by: Fred Nelson | last post by:
I'm devloping a VB.NET web application and I'm having a problem with trapping errors and logging the cause of them. In my web.config file I have the line: <customErrors ......
0
by: Fred Nelson | last post by:
I'm devloping a VB.NET web application and I'm having a problem with trapping errors and logging the cause of them. In my web.config file I have the line: <customErrors ......
2
by: Fred Nelson | last post by:
I'm devloping a VB.NET web application and I'm having a problem with trapping errors and logging the cause of them. When an unexpected error occurs I want to write it to a file - or e-mail it to...
3
by: Doug | last post by:
Using Visual Studio 2005, SQL Server 2000, and ASP.NET/VB.NET for a Web Application. We have a System DSN using Windows NT authentication defined on the development box to connect to the SQL...
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
1
by: =?Utf-8?B?QWNl?= | last post by:
hello, i just converted old .net project (it was a solution with web project and class project) built in .net 1.0 and 1.1 framework to .net 2.0. as i expected, when i clicked on the solution file...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.