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.RegisterHi ddenField("__EV ENTTARGET", "Button2")
Line 45: Dim currentWindowsU ser As New IIdentity =
WindowsIdentity .GetCurrent(); <--- the error in red
Line 46: trace.warn("cur rentWindowsUser .Name = " +
currentWindowsU ser.Name);
Line 47: trace.warn("cur rentWindowsUser .Authentication Type = " &
currentWindowsU ser.Authenticat ionType);
Source File: C:\Inetpub\wwwr oot\staffingwor kshop\tomtest.a spx Line: 45
*************** *************** *************** *************** *****
In my Global.asax I have
*************** *************** *************** *************** ***********
Sub Application_Err or(Sender As Object, E as EventArgs)
Dim exception As Exception = Server.GetLastE rror()
Dim ErrorString as String
While Not exception Is Nothing
ErrorString &= "Source: " & exception.Sourc e & vbCrLf & _
"Message: " & exception.Messa ge & vbCrLf & _
"Stack Trace: " & vbCrLf & exception.Stack Trace & vbCrLf &
vbCrLf
exception = exception.Inner Exception
End While
Dim MyMessage as New MailMessage
MyMessage.To = "xx@solutions.c om;yy@yahoo.com "
MyMessage.From = "xx@solutions.c om"
MyMessage.Subje ct = "Unhandled ASP.Net Error"
MyMessage.Body = vbCrLf & vbCrLf & "An Error was Generated on " & now &
vbCrLf & vbCrLf & _
"To see a list of Errors:
HTTP:\\www.staf fingworkshop.co m\administratio n\showException s.aspx" & vbCrLf
& vbCrLf & _
"Page: " & HTTPContext.Cur rent.Request.Ur l.ToString() & vbCrLf &
vbCrLf & ErrorString
SmtpMail.SmtpSe rver = Application("Ma ilServer")
SmtpMail.Send(M yMessage)
Context.ClearEr ror()
response.Redire ct("/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.T emplateParser.G etParserCacheIt emInternal(Bool ean
fCreateIfNotFou nd)
at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path()
at System.Web.UI.T emplateParser.G etParserCacheIt em()
at
System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context,
String requestType, String url, String path)
at System.Web.Http Application.Map HttpHandler(Htt pContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
at
System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously)
Source: System.Web
Message: External component has thrown an exception.
Stack Trace:
at
System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Comp ilation.BaseCom piler.GetCompil edType()
at System.Web.UI.P ageParser.Compi leIntoType()
at System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation()
*************** *************** *************** *************** **************
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