简体   繁体   中英

Customed ASP.NET Error Message

I followed this tutorial to create a custom error page. But I only have a white page and the url isn't my error page. In my web.config file, I added :

<customErrors mode="RemoteOnly" defaultRedirect="~/friendlyErrorPage.htm"/>

But it doesn't work... I launched an error by deleting some columns in my database.

For now, I just want to show a page when there is an error, I don't care abour your role, just a generic page.

Thanks in advance,

Antoine

EDIT : I used log4net to send error by mails. I commented the code in application_error and it works ! Wich line is the problem ?

String err = Server.GetLastError().ToString();
Exception ex = Server.GetLastError().GetBaseException();
log.Error(err, ex);
Server.ClearError();

It looks like

Server.ClearError();

block the error page, it seems to work without this line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM