Error Handler

T

tshad

I have set up an error handler in the Global.asax, but it doesn't give me
the information I can get from the Normal Windows Error page.

This is really preventing me from being able to fix errors quickly as it
only tells me I got an error, but normally not much on what the error was.

If I have no Handler, I get the following:

******************************************************************
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30205: End of statement expected.

Source Error:

Line 43: if not IsPostBack then
Line 44: Page.RegisterHiddenField("__EVENTTARGET", "Button2")
Line 45: Dim currentWindowsUser As New IIdentity =
WindowsIdentity.GetCurrent(); <--- the error in red
Line 46: trace.warn("currentWindowsUser.Name = " +
currentWindowsUser.Name);
Line 47: trace.warn("currentWindowsUser.AuthenticationType = " &
currentWindowsUser.AuthenticationType);

Source File: C:\Inetpub\wwwroot\staffingworkshop\tomtest.aspx Line: 45
*****************************************************************

In my Global.asax I have
***********************************************************************
Sub Application_Error(Sender As Object, E as EventArgs)
Dim exception As Exception = Server.GetLastError()
Dim ErrorString as String

While Not exception Is Nothing
ErrorString &= "Source: " & exception.Source & vbCrLf & _
"Message: " & exception.Message & vbCrLf & _
"Stack Trace: " & vbCrLf & exception.StackTrace & vbCrLf &
vbCrLf
exception = exception.InnerException
End While

Dim MyMessage as New MailMessage
MyMessage.To = "(e-mail address removed);[email protected]"
MyMessage.From = "(e-mail address removed)"
MyMessage.Subject = "Unhandled ASP.Net Error"
MyMessage.Body = vbCrLf & vbCrLf & "An Error was Generated on " & now &
vbCrLf & vbCrLf & _
"To see a list of Errors:
HTTP:\\www.staffingworkshop.com\administration\showExceptions.aspx" & vbCrLf
& vbCrLf & _
"Page: " & HTTPContext.Current.Request.Url.ToString() & vbCrLf &
vbCrLf & ErrorString

SmtpMail.SmtpServer = Application("MailServer")
SmtpMail.Send(MyMessage)

Context.ClearError()
response.Redirect("/PageError.aspx")
End Sub
***********************************************************************

What I get in my Email is:

**************************************************************************
An Error was Generated on 4/24/2006 5:52:48 PM

To see a list of Errors: HTTP:\\www.xx.com\ad\showExceptions.aspx

Page: http://www.xx.com/test.aspx

Source: System.Web
Message: External component has thrown an exception.
Stack Trace:
at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound)
at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
at System.Web.UI.TemplateParser.GetParserCacheItem()
at
System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.TemplateControlParser.GetCompiledInstance(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context,
String requestType, String url, String path)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
at
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)

Source: System.Web
Message: External component has thrown an exception.
Stack Trace:
at
System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Compilation.BaseCompiler.GetCompiledType()
at System.Web.UI.PageParser.CompileIntoType()
at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation()
**************************************************************************

As you can see, it tells me nothing????

Sometimes I will get decent errors, but more often than not I get something
like this.

This is really preventing me from being able to proactively fix errors on my
site as it only tells me I got an error, but not much on what the error was.

I have been trying to figure this out for months. There must be a better
way.

Thanks,

Tom
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top