CustomErrors does not work when setting redirectMode=“ResponseRewrite”

前端 未结 10 2054
野趣味
野趣味 2020-11-27 11:51

In a old site, I was changing the way that CustomErrors works by adding redirectMode=\"ResponseRewrite\" (new in 3.5 SP1):



        
10条回答
  •  春和景丽
    2020-11-27 12:35

    What's happening is IIS is seing the error status code and presenting it's own error page instead of yours. To solve you need to set this in the code behind page of your error page to prevent IIS from doing this:

    Response.TrySkipIisCustomErrors = true;
    

    This will only work in IIS7 or above, for earlier versions of IIS you'll need to play with the error page settings.

提交回复
热议问题