Можно ли изменить шаблон страницы ошибки «Необработанное исключение» в .NET?

241
user2924019

Наш клиент хочет иметь возможность изменить дизайн страницы, которая отображает «Необработанное исключение».

Мы используем Visual Studio 2012 с C # .NET (ASPX).

Возможно ли это сделать?

Редактировать: Спасибо за отрицательные отзывы. Не хочешь объяснить, почему?

-4

1 ответ на вопрос

1
Ƭᴇcʜιᴇ007

From Microsoft: Displaying a Custom Error Page (C#):

When an unhandled exception arises in an ASP.NET application one of three types of error pages is displayed:

  • The Exception Details Yellow Screen of Death error page,
  • The Runtime Error Yellow Screen of Death error page, or
  • A custom error page

Short version:

  • Create a custom web page in your ASP.NET web app.
  • Add customErrors markup to the configuration -> system.web section of your application's web.config file:

    <system.web> <customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPages/Oops.aspx" /> </system.web> 

See the above link for additional information on how to do it, as well as how to add custom pages for individual HTTP status codes, etc.