473,748 Members | 8,392 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 2121
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
5925
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
3021
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
4567
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
8991
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
8830
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
9544
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...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
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...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
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();...
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.