asp.net - Blank custom 404 page after deploying to IIS 7.5 -


incorrect urls http://localhost:54321/foo/bar , errors httpnotfound() handled in localhost without problems. after deploying iis 7.5, return blank page on both of above scenarios. i've seen else had problem here(it comment moulde several upvotes). code:

web.config

<system.web>   <customerrors mode="off" redirectmode="responseredirect">     <error statuscode="404" redirect="~/error/notfound"/>   </customerrors> </system.web> <httperrors errormode="custom" existingresponse="replace">   <remove statuscode="404" />   <error statuscode="404" responsemode="executeurl" path="/error/notfound"/>   <remove statuscode="500" />   <error statuscode="500" responsemode="executeurl" path="/error/error"/> </httperrors> 

errorcontroller

public class errorcontroller : controller {     public actionresult notfound() {         response.statuscode = 404;         response.tryskipiiscustomerrors = true;         return view();     } } 

routeconfig

 routes.maproute(             "error - 404",             "notfound",             new { controller = "error", action = "notfound" }             );          routes.maproute(             "error - 500",             "error",             new { controller = "error", action = "error" }             );         routes.maproute(             name: "default",             url: "{controller}/{action}/{id}",             defaults: new { controller = "home", action = "index", id = urlparameter.optional }         ); 

notfound

<h2>404 not found</h2> <div class="alert alert-info">     <p><strong>whoops...</strong></p>     <p>the resource looking doesn't exist</p> </div> 

the server runs windows server 2008 r2. when go .../foo/bar or action returns httpnotfound(), returns blank page. idea?

home/test

public class homecontroller: controller{     // ...     public actionresult test(){         return httpnotfound();     } } 

update: when go /error/notfound on server, returns blank page 404. response fiddler:

http/1.1 404 not found cache-control: private content-type: text/html; charset=utf-8 server: microsoft-iis/7.5  x-aspnetmvc-version: 5.2 x-aspnet-version: 4.0.30319 x-sourcefiles: =?utf-8?b?  qzpccwhlxfbyb2ply3rzxfzlbmrvclbvcnrhbfxwzw5kb3jqb3j0ywxcrxjyb3jctm90rm91bmq=?= x-powered-by: asp.net date: thu, 23 apr 2015 13:24:49 gmt content-length: 5434 

update 2: if take existingresponse="replace" away, can open error/notfound on server. still got blank page on myserver/myproject/foo/bar

in case reason in iis - web settings - request filtering - sql injection filter...

if url or query string contains ;, response ends status 404.19 - denied filtering rule. blank page displayed. iis redirect custom error http://server.com/error404.aspx?404;http://server.com/missingurl , char ; why request filter end request because of sql injection.


Popular posts from this blog