开发者

Simulating RemoteOnly custom errors using Application_Error ASP.NET

开发者 https://www.devze.com 2022-12-12 10:16 出处:网络
I handle my errors using Application_Error in global.asax. How to check if the request is from the local client to display more information about the error or just show the yellow error page. Someth

I handle my errors using Application_Error in global.asax.

How to check if the request is from the local client to display more information about the error or just show the yellow error page. Something like "remoteOnly" that ASP d开发者_JAVA百科oes when handling errors using web.config.


After I posted the question, I went back to my application and played around a little bit then I found this. Now I'm using it.

    void Application_Error(object sender, EventArgs e)
    {

        if(!HttpContext.Current.Request.IsLocal) 
            HttpContext.Current.Server.ClearError();

        // process error handling
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号