asp.net - Custom error redirect on 404 code for non-aspx files -
i added web.config:
<customerrors mode="remoteonly" defaultredirect="~/pages/error/error.aspx"> <error statuscode="404" redirect="~/pages/error/error404.aspx"/> </customerrors>
and works fine .aspx pages. when try type: http://domainname.com/notexist
, default 404.
i tried suggestions from: 404 redirecting non aspx pages
but nothing works me. ideas why?
i use .net 3.5, application pool pipeline mode integrated.
after adding <httperrors>
get:
try this, provide separate status. can execute per requirement.
<system.web> <customerrors mode="remoteonly" defaultredirect="~/pages/error/error.aspx"> <error statuscode="404" redirect="~/pages/error/error404.aspx"/> </customerrors> </system.web> <system.webserver> <asp scripterrorsenttobrowser="true"/> <httperrors errormode="detailed"> <error statuscode="401" path="/pages/error/error.aspx" responsemode="redirect" /> <error statuscode="403" path="/pages/error/error.aspx" responsemode="executeurl" /> <error statuscode="404" path="/pages/error/error404.aspx" responsemode="executeurl" /> <error statuscode="500" path="/pages/error/error.aspx" responsemode="executeurl" /> </httperrors> </system.webserver>
Comments
Post a Comment