VS 02/03 Application_Error in Global.asax not returning Error line numbers-VBForums
Results 1 to 6 of 6

Thread: Application_Error in Global.asax not returning Error line numbers

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    2

    Application_Error in Global.asax not returning Error line numbers

    I have a .Net web application where any uncaught exceptions get handled via the Application_Error event in Global.asax. Here, I email myself details of any uncaught exceptions that sneak through.

    My problem is that while I am getting the error messages just fine, I am not getting the line numbers in the stack trace to denote where the error is happening.

    The Application_Error code is as follows:

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Error
    ' Fires when an error occurs
    Dim Context As System.Web.HttpContext = HttpContext.Current
    Dim Ex As System.Exception = Context.Server.GetLastError.GetBaseException
    Dim Path As String = Context.Current.Request.Url.AbsolutePath

    Try
    objMailMessage.From = "..." : objMailMessage.To = "..."
    objMailMessage.Subject = "Global Error - " & System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath)
    objMailMessage.Body = Ex.Message & "<BR>" & Ex.Source & "<BR>" & Ex.StackTrace & "<BR>" & Ex.TargetSite.Name
    Finally
    objSmtpMail.Send(objMailMessage)
    objSmtpMail = Nothing
    End Try

    Context.Server.ClearError()
    End Sub


    The specific error email I'm getting is:

    Input string was not in a correct format.
    mscorlib
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    StringToNumber


    Of note, I already have the PDB file in the bin folder, as well as have debug set to true in my web.config. Also, this web app was built in Visual Studio 2003, and is running in a .Net 4.0 app pool in IIS 7.5.

    Am I doing something wrong in trying to obtain fully detailed error messages, with line numbers, etc? Thanks in advance for any insight you can provide.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    3,791

    Re: Application_Error in Global.asax not returning Error line numbers

    May i suggest that you take a look right at the server error messages.
    What pdb file? Note that i haven't ever used vs2003 web app in IIS7.5 so it may need some files but...
    Slow as hell.

  3. #3
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,961

    Re: Application_Error in Global.asax not returning Error line numbers

    Quote Originally Posted by lysv View Post
    Also, this web app was built in Visual Studio 2003, and is running in a .Net 4.0 app pool in IIS 7.5.
    Just out of interest, are you sure that this is correct? VS 2003 can't target .Net 4.0.

    Gary

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Posts
    2

    Re: Application_Error in Global.asax not returning Error line numbers

    Quote Originally Posted by gep13 View Post
    Just out of interest, are you sure that this is correct? VS 2003 can't target .Net 4.0.

    Gary
    Hi thanks for the reply guys.

    The application was built in Visual Studio 2003 so initially it was .Net 1.1 through and through. I cant say for sure that it targets .Net 4.0 as I'm not entirely knowledgeable with how to view what framework the project is targeting in VS 2003 as I am with VS 2008+; however the web.config does have certain section groups in the config sections at Version=4.0.0.0. Also, it's definitely running in a .Net 4.0 app pool.

    Regarding my issue, as it turns out, the actual problem wasnt really related to exception handling. Apparently there are problems with .Net 4.0 and Internet Explorer 10, specifically with regards to Image Buttons, and I believe javascript as well. I think .Net 2.0 also may have issues.

    See: http://connect.microsoft.com/VisualS...utton-does-not

    Hotfix available here: http://www.microsoft.com/en-us/downl....aspx?id=39257

    I applied the hotfix on my server about an hour ago, and it appears to no longer be a problem on IE 10 for myself. Will continue to monitor throughought the day to ensure outside IE 10 users dont have problems any more as well.

    Will update if there are any further issues. Thanks again!

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    3,791

    Re: Application_Error in Global.asax not returning Error line numbers

    Ah the infamous Iexplorer 10. Known to be used by werewolves and witches and little troubled children on Elm street.
    I think IE10 is one of the best things that Micro$oft ever created. It really tops up, right there with Windows Vista, Millennium, W8 and IExplorer 6 and 7(the zoom function gave us something knew to think about for those lonely nights without water and fresh fruits). You have spared patches that you don't use because IE9 is somewhat stable by now? Then how about creating a new IExplorer and start patching like crazy? It's not really patches, they are enchantments. Like when you have the +5 sword and you use a fire gem and a poison gem to enchant it's powers. That is what they do with IE10 but here is more like having a Short Sword + 1 to enchant.
    Microsoft is in denial for some time now.
    Last edited by sapator; Jun 26th, 2013 at 08:01 PM.
    Slow as hell.

  6. #6
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Application_Error in Global.asax not returning Error line numbers

    Yes .net 2 and 4 have issues with browser deffinition files that don't recognise the latest userAgent string sent by new browsers IE10 etc and treated them as down level browsers. .net 4.5 browser deff files does not down level new browsers... doesn't disable cookies/JS. MS updates should have patched this but that's not garenteed as you found out.

    Also there are issues with running a .net 1 or 2 targeted site on a .net 4 "Intergrated" app pool but shouldn't be a problem on .net 4 "Classic" app pool.
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.