Solved

Confusing Response.Redirect Behavior

Posted on 2012-03-13
2
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

705 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