When Should I Use Response.Redirect(url, true)?

前端 未结 5 1501
夕颜
夕颜 2020-12-03 09:32

I\'m redirecting to an Error page with a prettified error message in my Application_Error, in Global.asax.

At the moment it says:

Respon         


        
5条回答
  •  忘掉有多难
    2020-12-03 10:20

    You never need to use true, as there is an overload without the boolean parameter.

    Response.Redirect("Error.aspx", false);
    

    or

    Response.Redirect("Error.aspx");
    

    The boolean parameter was added so that you could set the redirect without stopping the execution. If you can exit out of the page code yourself without that causing any extra cost, like for example data binding occuring, that is preferable.

提交回复
热议问题