asp.net mvc - Why should we use HandleErrorAttribute? -


i new mvc. reading error logging in mvc.

i came know handleerrorattribute. have question regarding that.

let's placed handleerrorattribute in action.

<!-- language: c# --> [handleerror(view = "error")] public actionresult index6() {     throw new exception("something terrible happened.");      return view(); } 

and turned on custom errors in web.config

<customerrors mode="on"> </customerrors> 

now if undandled exception occured in "index action", show error.cshtml in "views/shared" folder.

but can have same behavior setting configuration under customerrors section in web.config.

<customerrors mode="on" defaultredirect="~/error">     <error statuscode="404" redirect="~/error/notfound" /> </customerrors> 

just mention, have "errorcontroller" "index" action returns "views/shared/error.cshtml" view.

so, question why should use handleerrorattribute? there benefits of using that?

thanks

this post should getting things cleared


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -