[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Detailed Error Message

Alright with custom Error handling off I get errors like this:

Server Error in '/' Application.
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: BC30451: Name 'flexrate' is not declared.

Source Error:

Line 101:    
Line 102:            if flexspending = 0 then
Line 103:                flexrate.text = ""
Line 104:                flexspendingtext.text = "(Waived)"
Line 105:            else

Source File: E:\DemoSCA\EnrollmentSummary.aspx    Line: 103

What I want to do is have that same information emailed to me and then have a custom error page displayed instead.

but the only output I can get is:

Error Message:
External component has thrown an exception.

Error Source:

Error Type:

Target Site:
Void ThrowIfCompilerErrors(System.CodeDom.Compiler.CompilerResults, System.CodeDom.Compiler.CodeDomProvider, System.CodeDom.CodeCompileUnit, System.String, System.String)

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()

and that is using this code to generate that:

Protected Sub Application_Error(ByVal Sender as Object, ByVal e as EventArgs)
        Dim ErrorDescription As Exception = Server.GetLastError
        Dim url As String
        Dim body As String
        If Not (ErrorDescription Is Nothing) Then
        ErrorDescription = ErrorDescription.InnerException
    'Build My message body
        body =  "<b>Error Message:</b><br>" & ErrorDescription.Message & _
                "<br><br><b>Error Source:</b><br>" & ErrorDescription.Source & _
                "<br><br><b>Error Type:</b><br>" & ErrorDescription.GetType.ToString() & _
                "<br><br><b>Target Site:</b><br>" & ErrorDescription.TargetSite.ToString() & _
                "<br><br><b>Stack:</b><br>" & ErrorDescription.StackTrace & _
        url = Request.Url.AbsoluteUri
        Dim mailMessage As New MailMessage
        mailMessage.From = "emailaddy@me.com"
        mailMessage.To = "emailaddy@me.com"
        mailMessage.Subject = "WEB SITE ERROR REPORT"
        mailMessage.BodyFormat = MailFormat.Html
        mailMessage.Body = body
        mailMessage.Body += url
        System.Web.Mail.SmtpMail.SmtpServer = "DELTA"
End If
End Sub

so what am I doing wrong, why can I not get it to send me the information it displays with custom errors off?


1 Solution
As the exception says, EnrollmentSummary.aspx line 103 is using "flexrate" variable that is not declared or invalid in the context. You have perhaps decared the variable in a loop, or setting it to null and this is causing this error to happen.

NBAISAuthor Commented:
I know that its throwing an error, I am making it do that on purpose so I can test the output of my custom error page, though when i setup the custom error page it doesnt give me anything really feesable to work with.  

It doesnt even give me a line number or anything really.  So when custom error pages are used, it formats bad, but when i use default error handling, it gives me the information I want.  

I need to know how to get the information I want into my custom error handler.


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now