title: Identify the postback from a ASP.NET Login control
body: <p>I have a <code>&lt;asp:Wizard&gt;</code> that is only applicable for a logged-out user. If the user is currently logged in, he/she is redirected to another page. On one of the wizard steps, as part of the wizard, I ask for credentials via the <code>&lt;asp:Login&gt;</code> control and log in the user. This presents a problem.</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin.aspx" rel="nofollow">According to MSDN</a>: "When a user uses the Login control to log in to a Web site, all data in the view state and all post data is lost. Do not perform actions in the LoggedIn event that rely on the view state."</p>
  
  <p>Because of this, my Wizard control forgets the step it's on after the login process. <a href="http://msdn.microsoft.com/en-us/library/t863ehhh.aspx" rel="nofollow">MSDN recommends</a>: "If you embed the Login control in a WizardStep object, explicitly set the ActiveStepIndex property in a Page_Load event handler if the user is authenticated. The Wizard control does not automatically advance to the next WizardStep object in this scenario."</p>
  
  <p>However, because all view state is lost, the redirect for logged-in users kicks in, sending the user away from the page. What's the best way to determine, at page load, which of the states the user is in?</p>
  
  <ul>
  <li>Already logged in some time ago; needs to be redirected.</li>
  <li>Was just logged in from inside the wizard; needs to reach the next wizard step.</li>
  </ul>
  
  <p>Thanks for any ideas.</p>