locked
redirect RRS feed

  • Question

  • difference between true and false in this code...

    Response.Redirect("url",true); and Response.Redirect("url", false);



    swati mishra

    • Moved by Jason Dot Wang Friday, January 11, 2013 6:45 AM This thread is about ASP.NET
    Thursday, January 3, 2013 10:42 AM

Answers

All replies

  • If you pass 'false', then after calling Response.Redirect, the system will continue executing the statements after Response.Redirect. On the other hand, if you pass true, then after calling Response.Redirect, the system will call Response.End to terminate the current thread, so no more statements after Response.Redirect are executed.

    For more info, visit below links,

    http://msdn.microsoft.com/en-us/library/a8wa7sdt(v=vs.80).aspx

    http://stackoverflow.com/questions/6707465/when-should-i-use-response-redirecturl-true

    I hope this helps.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Shyam Kr Thursday, January 3, 2013 11:33 AM
    • Marked as answer by Just Karl Friday, October 3, 2014 9:58 PM
    Thursday, January 3, 2013 11:30 AM
  • Hi,

            The HttpResponse class implements two overloaded versions of the Redirect method.
    • The first overloaded method takes only one input parameter, which is the URL for the target location. This version is defined as follows: public void Redirect(string url); 
    • The second overloaded method takes two input parameters: the URL for the target location, and a boolean value that indicates whether to stop running the current page. This version is defined as follows: public void Redirect(string url, bool endResponse);


    -Arun

    Thursday, January 3, 2013 11:31 AM
  • Hi swati88,

      Welcome to MSDN Forum Support.

     

      You are more likely to get more efficient responses to  ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.

      Sincerely,

      Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Just Karl Friday, October 3, 2014 9:58 PM
    Friday, January 11, 2013 6:44 AM