How to get which page threw an exception to Application_error in aspx

后端 未结 2 491
花落未央
花落未央 2020-12-10 11:29

I have a general exception handler, Application_error in my global.asax where I\'m trying to isolate all the uncaught exceptions on all my many pages. I don\'t want to use P

相关标签:
2条回答
  • 2020-12-10 12:18
    HttpContext con = HttpContext.Current;
    con.Request.Url.ToString()
    
    0 讨论(0)
  • 2020-12-10 12:30

    Remember, the page is not (should not) always be the cause of the exception. It could just as easily be coming from another assembly - and if you don't have your logic in your codebehinds, it likely will be coming from another assembly. Don't get me wrong, it is great to know which page, from the aspect of saying X Page caused Y exception in Z assembly.

    0 讨论(0)
提交回复
热议问题