Detailed Error Message

Posted on 2006-05-31
Last Modified: 2012-05-05
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 = ""
        mailMessage.To = ""
        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?


Question by:NBAIS
    LVL 25

    Accepted 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.


    Author Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now