473,699 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application_Err or being ignored

I am using VS2005 Professional, DOT.NET FrameWork 2.

During testing and debugging through the IDE using the development machine
LocalHost server whenever an error is encountered the Application_Err or fires
OK and all code in the function is executed successfully.

When this application is deployed to the production (using a deployment
project). When errors occur the code in Application_Err or is ignored
completely and the error is displayed using the DOT.NET standard error
reporting page.

I noticed that the Global.asax contains:
<%@ Application Codebehind="Glo bal.asax.cs" Inherits="HRsca peLite.Global"
Language="C#" %>
only so I am assuming that the code is in the DLL.

Any help/suggestions is greatly appreciated.
Alex

Nov 6 '07 #1
2 2116
Do you have the code that appears in the Application_Err or handler in
global.asax?
If it calls Server.ClearErr or this will prevent display of the error page.
You might want to post the actual code if you have it. if not, use Reflector
to decompile it out and examine.
--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Alex Munk" wrote:
I am using VS2005 Professional, DOT.NET FrameWork 2.

During testing and debugging through the IDE using the development machine
LocalHost server whenever an error is encountered the Application_Err or fires
OK and all code in the function is executed successfully.

When this application is deployed to the production (using a deployment
project). When errors occur the code in Application_Err or is ignored
completely and the error is displayed using the DOT.NET standard error
reporting page.

I noticed that the Global.asax contains:
<%@ Application Codebehind="Glo bal.asax.cs" Inherits="HRsca peLite.Global"
Language="C#" %>
only so I am assuming that the code is in the DLL.

Any help/suggestions is greatly appreciated.
Alex
Nov 6 '07 #2
I did some more digging. Here is the actual code:

protected void Application_Err or(object sender, EventArgs e)
{
Exception objErr = new Exception();
objErr = Server.GetLastE rror().GetBaseE xception();

int EventID = 62300;
string err = "Error In: " + Request.Url.ToS tring() + "\r\n"
+ "Error Source: " + objErr.Source.T oString() + "\r\n"
+ "Error Message: " + objErr.Message. ToString() + "\r\n"
+ "Stack Trace: " + objErr.StackTra ce.ToString() + "\r\n";

System.Diagnost ics.EventLog.Wr iteEntry("MyApp ", err,
System.Diagnost ics.EventLogEnt ryType.Error, EventID);

Server.ClearErr or();

MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("er ***@XXXX.com");
mailMsg.To.Add( "ab*@XXXX.com") ;
mailMsg.Subject = "Event ID " + EventID.ToStrin g()
+ " in Application MyApp";
mailMsg.Body = err;
SmtpClient smtp = new SmtpClient("smt p.XXXX.com");
smtp.Credential s = new System.Net.Netw orkCredential(
"UID", "PWD");
smtp.EnableSsl = true;
smtp.Send(mailM sg);

Response.Write( "An error occured in the MyApp. "
+ "An e-mail alert was sent to support staff. "
+ "Please quote EVENT ID: " + EventID.ToStrin g()
+ " when following up with customer support");

}

When I commented out:
System.Diagnost ics.EventLog.Wr iteEntry("MyApp ", err,
System.Diagnost ics.EventLogEnt ryType.Error, EventID);
The email message was sent out. off course the event was not logged. So I am
assuming here that this boils down to a rights problem. so I reactivated
writing to the event log and gave ASPNET user Administrator priviledges. That
did not work.

Any Suggestions?

Nov 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5918
by: Greg Burns | last post by:
I am trying to write a global custom error page. I thought I would jot down some of what I've learned so far... At first I just used the default customErrors section with a defaultRedirect tag, as such: <customErrors defaultRedirect="error.aspx" mode="On" /> First thing I found out about this method, is that I didn't have access to the exception object in my error.aspx page. So this page was going to be
2
3019
by: A.M | last post by:
Hi, I have the following code in Global.asax. Using a breakpoint, i can see that that all errors are being trapped in Application_Error and the event handler is being run properly. The problem is still it shows standard ASP.NET error screen. That means Response.Redirect ("genericerror.htm "); is being ignored. How can i fix this problem ? Thanks, Allan
2
444
by: A.M | last post by:
Hi, I have the following code in Global.asax. Using a breakpoint, i can see that that all errors are being trapped in Application_Error and the event handler is being run properly. The problem is still it shows standard ASP.NET error screen. That means Response.Redirect ("genericerror.htm "); is being ignored. How can i fix this problem ? Thanks, Allan
6
4558
by: Matt | last post by:
Can anyone give me a good reason to use BOTH application scope Page_Error and the page scope Page_Error when trapping errors in a web application? Is there any real benefit to using the Page_Error if you are already capturing errors in Application_Error? Also, if you have any links to discussions about when to use which function it would be helpful.
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.