CustomErrors does not work when setting redirectMode=“ResponseRewrite”

前端 未结 10 2087
野趣味
野趣味 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:43

    In my particular case, my error page had a master page that had a user control that tried to use Session. If Session isn't available, you get an HttpException: "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive." Easiest fix is to switch to static html, second easiest fix is to use a simpler error page, hardest fix is to make incredibly sure that your error page makes no assumptions anywhere (like that Session won't throw an exception, for example) and can't possibly error out.

提交回复
热议问题