Should we use Response.Redirect ( url, true) or Response.Redirect ( url, false) ?

Normally most of the time we use Response.Redirect (url). How is this different from Response.Redirect ( url, true) or Response.Redirect ( url, false) ? Also, what is the best form of Redirect to use when going to another page?
sun21170
-1
sun21170
11/28/2006 5:26:05 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
2616 Views

Similar Articles

[PageSpeed] 15
Get it on Google Play
Get it on Apple App Store

The second parameter of Response.Redirect is endResponse which is boolean value that indicates whether to stop running the current page.

It depends on if you want to keep it alive or stop it.

Thanks 


Mark post(s) as "Answer" that helped you

Electronic Screw
Website||Blog||Dub@i.net
1
e_screw
11/28/2006 5:48:55 PM

In what situation, would someone pass a true for the endResponse parameter ?

 I would think, we would like to always end execution of current page when redirecting to another page, and so 'true' is always what we want to pass.


sun21170
1
sun21170
11/28/2006 6:12:55 PM
1
jessjing
11/29/2006 3:09:55 AM
Reply:

Similar Artilces:

Using # In a Response.Redirect URL
My asp.net pages error out if I try to put a pound (#) sign in a Response.Redirect() call.  I need to be able to redirect the page to another page and jump to a specific anchor on that page.Is there any way to bypass this error? Response.Redirect("http://www.google.com/#foo") Works good here. Would you mind posting the problematic code? HTHBenMCAD .Net (70-315, 70-320 & 70-229):One that throws dirt loses ground:...

Response.redirect (url) with url retrieved from a Ms Access Database
Hi, I have created a dropdownlist on an an aspx.page. This dropdownlist dpatm (list of countries) is filled with data from a Access.table (On Page_Load). The country selected by the browser is stored in a session "infoatm". When a browser clicks on the Search Button the subroutine "getdata" should be executed.  sub getdata (src as object, e as eventargs)dim strsql as stringdim myconnection as oledbconnectionmyconnection=new oledbconnection(ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Conn2"))dim mycommand as oledbcommandstrsql="SELECT tbl_Cou...

Response Redirect ( "URL", False)
I have not been able to Redirect from the current page to an informational location and leave the current page available with the following: Response.Redirect ( "URL", False) Am I forgetting something or is what I am attempting imposible? A redirect will redirect your browser to the new url. It will not leave the current window open. If you want to leave the current window open, and open another browser window, use window.open in javascript. You can open a new window like so: RegisterClientScriptBlock("Opener", "<script language='...

Response.Redirect(URL)
Hi there. I wish to link to a page (default.aspx) upon clicking a button. The page should be loaded in a frame (main). The code works but it loads the page in a full window. My code goes like this: Private Sub btnLecturerInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLecturerInfo.Click Response.Redirect("/default.aspx") End Sub Any idea? Thank you. You're going to have to do this with a hyperlink, or wire up some javascript to the button. Response.Redirect will not let you target a frame. Set the target att...

Exception on response.redirect("url", false)
I'm getting an exception in my debug window.  It does not break, but it's annoying trying to figure out why it's happening.  It happens on every response.redirect on every page in my applications.  If I do a response.redirect("url", true), then I get nasty threading exceptions (I was told it was because the response.redirect was within a try catch block.  When I break on the exception, it's a "File not found" error, with the file being NULL.  What's up with that? A first chance exception of type 'System.Web.HttpException...

How to use response.redirect without changing current URL
 In my left panel have some menus  , once if u click that menu then it would pass some values to master page ......remaining under here  Site.Master<%@ master language="VB" %><%@ import Namespace="system.IO" %><%@ import Namespace="system.Net" %><%@ Register TagPrefix="leftMenu" TagName="leftMenuIndex" src="./includes/leftpanel.ascx" %><script runat="server">    Sub page_load()               If (IsNo...

Difference between Response.Redirect("url"); and window.open('url',null);
I have the requirement of popup the webform. I have worried about the server event of that web form. Is there any difference between Response.Redirect("Url"); and window.open('Url'); Help me out? Thanks in Advance mrkk:Is there any difference between Response.Redirect("Url"); and window.open('Url'); The only difference is window.open() is a client side action and it will open the URL in a new browser window.Response.Redirect is a service side action that directs the current browser to the URL.  The difference is window.open() is a client s...

Using Response.Redirect() after Response.Flush()
I wonder if anyone might be able to help me with a problem I'm having in redirecting to a new page after calling Response.Flush(); The problem has arisen as a side effect of implementing a "Please Wait..." page that displays when clicking on a Search button. The following code is executed when the button's Click event is run: private void btnConfirm1_Click(object sender, System.Web.UI.ImageClickEventArgs e) { btnConfirm1.Visible = false; Response.Buffer = true; FileStream oFile = new FileStream(Request.PhysicalApplicationPath + "/Con...

Using Response.Redirect to create a URL : Can key-value pairs be hidden?
I've read a number of posts on using Response.Redirect to transfer to a different URL, but have yet to find an answer to my specific question. I apologize if it has been covered previously ... I am setting up a form-based shopping cart which needs to be transferred to a payment processing service (e.g. Verisign) which wants the information passed as follows : <form method="POST" action="https://payflowlink.verisign.com/payflowlink.cfm"> <input type="hidden" name="LOGIN" value="login_name"> <input type="hid...

No response from response.redirect
Hi, my asp.net project has atleast 10 webforms and for navigation the response.redirect was working fine till today. It stopped working in one of the pages but stills fine in the other pages. eg. the CANCEL button loads the previously navigated page. All CANCEL except one are working. I checked the button click event, put labels with messages in them; the labels get posted when the button is clicked; but when i remove the labels and put in the response.redirect("PAGE NAME") it stopped working; i even put the wrong path in the response.redirect, still the errorhandler or any o...

Response.Redirect not redirecting
 Hello all, I am trying to use the sample code for testing whether or not a browser accepts cookies (http://msdn.microsoft.com/en-us/library/ms178194.aspx). Unfortunately, I can not get the cookie test page to redirect back to the original page.  I have stripped away everything but the response.redirect statement and tried firing the cookie test page by itself.  The page loads fine, but won't redirect. Here is my current code: Imports System.WebPartial Class CookieAcceptanceTest    Inherits System.Web.UI.Page    Sub Page_Load()&...

Response.Redirect
Hi, Can any one practically guide me as what is the difference of Response.Redirect - True / False, I mean Response.Redirect('Default.aspx",True)     V/s    Response.Redirect('Default.aspx",False) I read some articles but not clearly understand. Please give me some practical example. Thanks If you are processing page "A" an then you issue a redirect    Response.Redirect('Default.aspx",True)  The client will be sent the redirect for the new page and Page "A" will immediately ...

Response.Redirect(url); _blank
 So I need to use Response.Redirect(url); . Following script works great.  <script> protected void Button2_Click(object sender, EventArgs e){string url = "~/product.aspx?product_id=" + DetailsView1.SelectedValue;Response.Redirect(url);}</script>  unfortunatly I would like to open the page in a new windowso I came up with the code<script>protected void Button2_Click(object sender, EventArgs e){session_completion.Update();string url = "~/product.aspx?product_id=" + DetailsView1.SelectedValue;Button2.Attributes.Add("onCl...

use response.redirect instead of redirect from loginpage (returnurl)
We would like to change the redirectfromloginpage (returnurl) from default.aspx to a virtual directory page websitename/vdir/default.aspx.The user needds to be validated and then sent to the new page. Our question is twofold: - How the heck do we do it (tried several ways all with no success)- do we need to "enablecrossappredirects" in the web config file (both main app and virtual)? Thanks for the help!  Below is the code from the html page. This method works great if we are accessing the virtual folder directly -  script language="VB" runat="server"...