asp.net mvc - Custom error page only works for 404 errors -
i have developed mvc5 page , have in web.config:
<customerrors mode="on" defaultredirect="/home/error" /> the problem works when enter non existing file in url, example, "/images/nonexisting". however, when enter "/images/" in url (this folder exist),
"error http 403.14 - forbidden"
is shown instead of custom error page.
how can solve this?
edit: not duplicated. referenced page defaultredirect not taking account @ all. in case, works 404 errors. 403.14 errors, not work.
one other fact took attention.
when placed mode=off in customerrors tag, , tried load "/images/nonexisting", error:
however, when tried load /images/, got following page:
as see, both pages have different look. think why not work, not sure how solve it.
it seems 404 errors trapped .net framework 403 errors trapped web server not reaching web site (that may why custom error page not shown). solution should try configure directly in web server?
furthermore, tried adding web.config, did not work either:
<customerrors mode="on" defaultredirect="~/home/error"> <error statuscode="403" redirect="~/home/error" /> </customerrors>


Comments
Post a Comment