c# - IIS overriding custom 404 error page in ASP.NET -
i trying create 404 error page , have of following/tried of following try , accomplish this. when user types in :
it works supposed to. if user types in:
with no .aspx iis7 takes matters own hands , lovely error page iis7 comes with. goal site redirects 404 status code (so not 200, or 302 redirect). have tried in both web config with:
<customerrors mode="on" defaultredirect="~/error/default.aspx redirectmode="responserewrite"> <error statuscode="404" redirect="~/error/notfound.aspx" /> </customerrors>
this works url .aspx file extension not no extension. same approach in global.asax
void application_error(object sender, eventargs e) { var servererror = server.getlasterror() httpexception; if (servererror != null) { if (servererror.gethttpcode() == 404) { server.clearerror(); server.transfer("~/error/notfound.aspx"); } server.transfer("~/error/default.aspx"); } }
the same results present :( final attempt apply web config:
<system.webserver> <httperrors existingresponse="passthrough" /> </system.webserver>
with plain white screen nothing on it... thoughts or comments appreciated!! in advance!
it seems application running in classic pipeline mode. change integrated , problem fixed. here article pipeline modes , differences - http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/
Comments
Post a Comment