asp.net mvc errorhandler not showing custom error page -
i trying follow examples in this link , this one instead of showing error page http 500 internal server error. have <customerrors mode="on" />
set in webconfig. have tried applying [handleerror]
filter controller class. tried without well. error.aspx present in /views/shared/ couldn't case of no file found.
i threw dividebyzero exception in controller's action method. want follow example can specify separate error page actions need them.
i using aspx view engine in blank project created. should not reason right?. using master page this. missing?
thanks
edit-added code
i added code new project , made web.config entry <customerrors mode="on" />
[handleerror] public class homecontroller : controller { // // get: /home/ [handleerror] public actionresult index() { throw new dividebyzeroexception(); return view(); } }
it didnt work! commented dividebyzeroexception , in aspx view added , invalid model.property. in both instances got internal server error. have done there done per documentation. see lot of other people having same problem , not being able solve too. bug in mvc 3?
i think have figured out problem. main home page index in master page. added same master page default error page comes out of box visual studio , worked me.
the documentation needs point out more important requirement,... if indeed one.
another amazing revelation don't need decorate controller classes [handleerror]
attribute. works without default error view. may provide attribute if want specific custom view action or controller. so:
[handleerror(view = "customerror")]
...where customerror.aspx plain aspx view page in either shared folder view or in view-controller folder itself.
has got working without putting error pages in master page, main calling page throws error in master page?
Comments
Post a Comment