Saturday, April 27, 2019

Asp.Net MVC (5) - Exception Filter - HandleError


Applicable on Asp.Net MVC5

HandleError Filter

This belongs to Exception Filters category (Authentication Filter, Authorization Filter, Action Filter, Result Filter & Exception Filter) . This is out of the box filter provided by .Net MVC team. We can develop our customized exception filter by extending the IException interface and overriding its method, the way other customized filters are created.

By default HandleError filter redirects to "Error" view placed in Views/Shared folder. This filter can be placed on controller level as well as on Action level. Whenever exception occurred this filter redirect to Error view (by default / custom view if specified in filter). 
Developer can place the error details on Error view. 

Scenario: In below situation there is some exception occurred (SQL connectivity / divide by zero / Null reference exception). In this case the system redirects to Error view showing the details of error. 

Wednesday, April 17, 2019

_Viewstart Page in ASP.NET MVC


_Viewstart is a special page to embed layout page with views.
  • The _ViewStart.cshtml page is a special view page containing the statement declaration to include the Layout page.
  • Instead of declaring the Layout page in every view page, we can use the _ViewStart page.
  • When a View Page Start is running, the “_ViewStart.cshtml” page will assign the Layout page for it.
  • This make very easy to maintainable application


㉺㉼㉴㉳㉽㉾㈕㈔㈆㈅㈄㈄㈃㈁㈀㉤ Ali Hamza Wadood  | Software Engineer - Microsoft Technologies| LinkedIn

Asp.Net MVC (5) - Exception Filter - HandleError

Applicable on Asp.Net MVC5 HandleError Filter This belongs to Exception Filters category (Authentication Filter, Authoriz...