Custom errors in asp.net Part 71

  • دعنا نشارك هذا :
ترتيب الدرس : 71
المدة : 00:14:07
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2012/12/custom-errors-in-aspnet-part-71.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-71-custom-errors-in-aspnet.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

If there is an unhandled exception, by default, the generic yellow screen of death is displayed. Instead, custom error pages can be displayed. Custom error pages can be defined at 2 levels
1. Application Level - In the web.config file using "customErrors" element.
2. Page Level - In the Page directive, using "ErrorPage" attribute.

Page level custom error pages takes precedence over application level custom error pages.

Custom error pages provide the flexibility of displaying a specific page in response to one or more of the available HTTP status codes.

To specify the custom error pages at an application level, use customErrors element in web.config

The mode attribute determines when a custom error page is displayed over the yello screen of death, exception page. Mode attribute can have On, Off, or RemoteOnly. Default is RemoteOnly.
On - Custom error pages are displayed both on local and remote machines
Off - Custom error pages are not displayed anywhere
RemoteOnly - Custom error pages are displayed on remote machines, and exception page on local machine

If the redirection is done in Application_Error() event handler in Global.asax, custom error pages will have no effect.

In your application, if you have to display specific custom error pages for specific http status codes, then use custom errors. If you just have one generic error page, then Global.asax can be used.

Please note that, the exception object needs to be retrieved, before the user is redirected to a custom error page. Because a custom error page is displayed through redirection, the context for the error is lost and Server.GetLastError returns nothing from the target custom error page.

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:24
youtube