Can the ASP.NET Yellow Screen of Death (YSOD) be generated on demand or captured?

前端 未结 6 1360
-上瘾入骨i
-上瘾入骨i 2020-12-30 14:52

We\'d like to just capture the YSOD output to use in an erorr reporting email, from a Global.asax error handler, for instance. Is there any way of leveraging the built-in ys

6条回答
  •  执念已碎
    2020-12-30 15:50

    The Application_Error event in the Global.asax file is triggered whenever an unhandled exception occurs in the application. You can grab the last exception that occurred using the Server.GetLastError() method.

    Similarly, you could create your own custom error page by specifying it in the web.config under the customErrors section in the web.config file. By specifying a default file, you can do any custom coding when an exception is routed there.

提交回复
热议问题