Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7810241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:41:52+00:00 2026-06-02T03:41:52+00:00

I’m a bit puzzled by the behavior of the default ASP.NET Authentication controls ,

  • 0

I’m a bit puzzled by the behavior of the default ASP.NET Authentication controls, by its lifecycle to be precise.

In my MasterPage, I added a LoginView Control which displays the nice [Login] or [Logout] links. When I am logged in and click on [logout], I set up the control to perform a redirection to the homepage of the application.

Internally, when a click on “logout” happens, a postback is triggered. The following steps happen (among others of course):

  1. The page that fired the postback is reinitialized
  2. The page that fired the postback is reloaded
  3. The LoggingOut event is fired
  4. The LoggedOut event is fired
  5. The page that fired the postback is PreRendered
  6. The redirection happens
  7. The target page is loaded (LoggedOut.aspx in my case)

On most of the pages, this works fine. But some pages expect some data to be initialized for their rendering to happens correctly. When this loggout postback occurs, the data isn’t correctly initialized, but the page is still PreRendered which leads to some… “unexpected behavior” >_<

My question is thus twofold:

  • Why does this rendering step happens since the page won’t be displayed at all?
  • Is there a way to prevent the rendering to happen?

Thanks a lot.
Tim

PS: here’s a small VS2010 sample project showing you the call sequence & page lifecycle if you want to try it out for yourself http://dl.dropbox.com/u/11764136/LoginTest.7z

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:41:53+00:00Added an answer on June 2, 2026 at 3:41 am

    Venemo’s answer gave me an idea that seems to be working.

    Instead of relying on the LoginStatus component to perform the redirection, I registered the MasterPage hosting the LoginStatus components to the LoginStatus.LoggedOut event and fire the redirection “per hand” before the PreRender step can be called.

    protected void Page_Load(object sender, EventArgs e)
    {
       MasterLoginStatus.LoggedOut += new EventHandler(OnUserLoggedOut);
    }
    
    private void OnUserLoggedOut(object sender, EventArgs e)
    {
       Response.Redirect("~/LoggedOut.aspx", true);
    }
    

    I was concerned the LoginStatus component might remain dirty by doing this but sofar I haven’t found any issue with it e.g. “works until proven otherwise”.

    Remains the question of “why the component behaves like this” but I guess it was a design decision that will remain unanswered.

    Edit: this works fine until you get the same problem for the “login” action. Haven’t found a way around this one yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.