c# - ASP.NET MVC 5 Custom Error Pages Doesn't Work -
i've set webconfig custom error pages. doesn't work. create controller , action name "hata". can see page "http://localhost/hata/bulunamadi" when try open not exists page custom error pages doesn't show. (i see iss default 404 page)
<system.web> <customerrors defaultredirect="~/hata/bulunamadi" redirectmode="responserewrite" mode="on"> <error statuscode="404" redirect="~/hata/bulunamadi"/> </customerrors> </system.web>
<customerrors mode="on" defaultredirect="~/error"> <error redirect="~/error/notfound" statuscode="404" /> </customerrors> and controller contains following:
public class errorcontroller : controller { public viewresult index() { return view("error"); } public viewresult notfound() { response.statuscode = 404; //you may want set 200 return view("notfound"); } }
Comments
Post a Comment