.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Response.Redirect Holds Other Pages from Loading

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net

Here's the scenario.

I've got a form with a button on it. You have to be logged in to see this form. I use this code to check if the user is logged in and act appropriatley.

Dim isLoggedIn As Boolean = CType(Session("LoggedIn"), Boolean)

        If isLoggedIn = False Then
        End If

The button runs a report that takes anywhere from 0.5 to 20 seconds. For testing it just sleeps for 10 seconds.


The problem is this. Say User1 comes to the form, logs in and runs the report. If User2 comes to the form, the page will not load until User1's report is done.

Now, the bonus is if I comment out the response.redirect line, everything works fine. But if that line is in there I will get this problem.

My quesiton is why is this happening? What's going on in the background that's causing this? Any way around it?

View Complete Post

More Related Resource Links

Response.Redirect slow


I'm in the middle of migrating servers and on the new server Response.Redirect is extremely slow. It takes around 20 seconds for the browser to get the redirect. This is something that was quick on the existing server. It's an ASP.NET 2.0 application, both servers are running IIS6.

Additionally, if I "manually" do the redirect, it's fast. For example:

Existing way:


takes around 20 seconds on the new server

New way:

Response.Status = "302 Moved Temporarily";
Response.AddHeader("Location", url);

is fast on the new server.

Any ideas why Response.Redirect would be so slow on the new server?



I need to open a new window with Response.Redirect, Is it possible?

Adding a cookie to a response.redirect vs. httpWebRequest


Hello, I will try to be as clear as I can be.  I'm sure this question has been asked but I can't find a suitable answer for this particular situation.

I need to be able to redirect the browser to a new 3rd party page while at the same time supplying a cookie required for some form of authentication on the 3rd party site.

I have managed to get this to work in the following manner:


'SessionID is predetermined by another HttpWebRequest/Response  

Dim sessionCookie As New Cookie("ezproxy", sessionID.Substring(1), "/", ".someother.site")

Dim CookieJar As New CookieContainer


rRequest = HttpWebRequest.Create("where I want to go")

rRequest.CookieContainer = CookieJar

rRequest.Method = "GET"


'Make the request and get the response.

rResponse = rRequest.GetResponse()


'Save cookie(s)

If (rResponse.Cookies.Count <> 0) Then

For Each cook

Exit Popup and response.redirect

Hi, I have a requirement to show an Exit Popup on one of our processing pages. I am showing the exit popup by registering a client side javascript like window.onbeforeunload = ShowExitPopUp(); The popup executes fine if you close the window, or try to type in a different URL. However the issue is that my processing page is also performing a "Response.Redirect" on the server side once the process completes. When response.redirect happens the exitpopup also shows up. Is there a way to have the exit popup not show up in that case? Since my server side code is running through an UpdatePanel, so I have tried registering the following, in an attempt to remove ExitPopup from client side. However this doesn't work since server side redirection happens before end request. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RemoveExitPopup); Has anyone faced a similar situation and handled it?

Response.Redirect("URL") and target="_blank"

in codebehid  I use Response.Redirect(http://www.google.com.hk/) I want the google page is open in a new Win ,did not cove my page, in html we can use target="_blank" How can I hadle it in Redirect? Thank you

What is the difference between Server.Transfer & response.Redirect()

Hello Friends,This is the very favourate question available on every interview questions site.I have searched for it. But didnt get the satisfactory practical difference between these two.Please show me the difference between this two through a working sample demo.Please ilustrate it through a simple sample.

Response.Redirect in new browser window

   protected void ddlPrint_Changed(object sender, EventArgs e)     {         if (ddlPrint.SelectedValue == "All Agenda Items")         {             Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                             Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));         }How can I open following report in new browser window using response.redirect? Thx   protected void ddlPrint_Changed(object sender, EventArgs e)    {        if (ddlPrint.SelectedValue == "All Agenda Items")        {            Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                            Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));        }}

Response.Redirect in C# for page to page parameter passing

Looking for examples of this, but can't find anything specific. I'm new to ASP.NET, and C# at the same time... so I'm struggling to get it right...  Thanks, Nick


Hi..Is it possible to go to the previous page from wherever we are currently is, using the Response.Redirect()?

Response.Redirect is not working with UpdatePanel

 Response.Redirect is not working with UpdatePanelafter migrating a web site to ASP.NET version 4.please help urgent

Response.Redirect problem in Google Chrome

I'm building an ASP.NET 3.5 webapplication using VB.NET, and I'm having problems redirecting to another URL when using Google Chrome. Other browsers like IE and Firefox are fine.My data entry forms all have an OK and an Cancel button, which are both handled server-side. The Cancel button just redirects back to the originating page, while the OK button will add or update a database record and then redirect to the originating page.The redirect to the originating page is done by calling the following shared sub on a general utilities class in my appication: Shared Sub Redirect(ByVal p_sURL As String) Dim l_sURL As String = p_sURL.ToLower If Left(l_sURL, 1) = "~" Then Dim l_oControl As New System.Web.UI.Control l_sURL = l_oControl.ResolveUrl(l_sURL) End If If Left(l_sURL, 1) <> "/" Then If Left(l_sURL, 7) <> "http://" AndAlso Left(l_sURL, 8) <> "https://" Then l_sURL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) & wsUtils.SiteRoot & l_sURL End If End If HttpContext.Current.Response.Redirect(l_sURL) 'HttpContext.Current.Response.Redirect(l_sURL, False) End Sub As you can see, I've tried using the extra argument in the Response.Redirect call, but that

Web Developer is not loading my web pages

Hi All,   In urgent need of some help. I have been using Visual Web Developer without any problems until yesterday, when it decided that it is no longer going to load any of my web pages.  I have tried creating a very simple project with a single hyperlink on the page, but the page does not load. If I  Change the "use dynamic ports" to false and select a port number i get the following message "unable to launch the ASP.Net development Server. Port 'xxxx' is in use". Does anybody have any ideas as to what could possibly have happened to my Web Developer to cause this?   Any help is appreciated.   ThanksEddieB

Response.Redirect in c# class.

Can you tell me the code of  private void btnnext_Click(object sender, EventArgs e)         {                               }   I am writing response.redirect but then also i am getting error can you plz helpThanks & Regard Aarti.Thakkar (nemo)

redirect to pages?


I have a page called ViewMessage. Also, there is a Inbox.aspx, Deleted.aspx and Sent.aspx. If the user is on the ViewMassage page and is in the Inbox mode I need to redirect back to the Inbox. If the user is on the ViewMessage page and is in the Deleted mode I need to redirect back to the Delete.aspx and so on, how do I call or tell which page to return to.

GridView and mouse double click Response.Redirect problem


VS 2005, AJAX 

I use gridview and I need single and double click for each row in gridview.

When I click once on a row, some action will execute (e.g. next button should be enabled) and when I double click the row there should be redirection to another page.

I used the code below for both single and double click  usage:


protected void GwContainers_RowDataBound(object sender, GridViewRowEventArgs e)
                if (e.Row.RowType == DataControlRowType.DataRow)
                    // Get the LinkButton control in the first cell

                    LinkButton singleClickButton = (LinkButton)e.Row.Cells[8].Controls[0];
                    // Get the javascript which is assigned to this LinkButton


Problems loading pages that require to be logged in.


So the problem is that when a user logs on the website and he tries to load a pages that requires someone to be logged in. For example to edit his profile or add a record to the database. So when I log in and try to load profile.aspx he gives me the following error.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 58:     Public Overridable Property Voornaam() As String
Line 59:         Get
Line 60:             Return CType(Me.GetPropertyValue("Voornaam"),String)
Line 61:         End Get
Line 62:         Set

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\flanders_website\925da723\20319e75\App_Code.45wzfix6.19.vb    Line: 60

However if I try to do this on my local machine for testing everything works fine. (on the same da

IHttpModule OnError Response.Redirect ignored?


Í'm writing an IHttpModule to catch the 404 error:

 public void Init(HttpApplication context)
    context.Error += new EventHandler(OnError);
public void OnError(Object source, EventArgs e)
    HttpContext context = ((HttpApplication)source).Context;

For some reason the Redirect is completely ignored? (the statement is reached and executed when debugging, but nothing happens)

Thanks in advance


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend