By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

Error Handler

P: n/a
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 = " +
Line 47: trace.warn("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 &
exception = exception.InnerException
End While

Dim MyMessage as New MailMessage
MyMessage.To = ";"
MyMessage.From = ""
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:\\\administration\sho wExceptions.aspx" & vbCrLf
& vbCrLf & _
"Page: " & HTTPContext.Current.Request.Url.ToString() & vbCrLf &
vbCrLf & ErrorString

SmtpMail.SmtpServer = Application("MailServer")

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:\\\ad\showExceptions.aspx


Source: System.Web
Message: External component has thrown an exception.
Stack Trace:
at System.Web.UI.TemplateParser.GetParserCacheItemInt ernal(Boolean
at System.Web.UI.TemplateParser.GetParserCacheItemWit hNewConfigPath()
at System.Web.UI.TemplateParser.GetParserCacheItem()
System.Web.UI.TemplateControlParser.CompileAndGetP arserCacheItem(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context,
String requestType, String url, String path)
at System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&

Source: System.Web
Message: External component has thrown an exception.
Stack Trace:
System.Web.Compilation.BaseCompiler.ThrowIfCompile rErrors(CompilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Compilation.BaseCompiler.GetCompiledTyp e()
at System.Web.UI.PageParser.CompileIntoType()
at System.Web.UI.TemplateParser.GetParserCacheItemThr oughCompilation()
************************************************** ************************

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


Apr 25 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.