Solved

Confusing Response.Redirect Behavior

Posted on 2012-03-13
2
325 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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