Solved

Confusing Response.Redirect Behavior

Posted on 2012-03-13
2
302 Views
Last Modified: 2012-03-13
I am taking over some code and am having trouble understanding it. In the Page_Load, there is a Response.Redirect that Visual Studio says is being executed.

But then the remainder of the statements in Page_Load execute and THEN the Page_Load of the second page.

I thought Response.Redirect was immediate.  Here's the code:

        If Request.IsAuthenticated = True Then
            Session.Abandon()
            FormsAuthentication.SignOut()
            Response.Redirect("~/Somepage.aspx", False)
        End If

        ' Session has been abandoned and FormsAuthentication has been signed out.

        If IsNothing(Request.Cookies("UserInfo")) = False Then

Open in new window


Can anyone explain how this works? Am I witnessing the impossible?
If I execute the Response.Redirect, how can I get to the 'if' a few lines later?
0
Comment
Question by:AIBMass
2 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37715340
Response.Redirect("~/Somepage.aspx", False)

The false says don't end the response, eg: keep loading the page.

If you want to do it immediately, set that to true.
0
 

Author Closing Comment

by:AIBMass
ID: 37715367
Sheesh. I won't be forgetting that. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now