title: How to get a username from asp:login to store in a session?
body: <p>I'm using a simple asp:login form for user authentication on my site.  I've set it up as basic as I can, and my code looks like this:</p>
  
  <pre><code>&lt;asp:Login ID="LoginForm" runat="server"
      DestinationPageUrl="~/LoggedIn/TaskPanel.aspx" &gt;
  &lt;/asp:Login&gt;
  </code></pre>
  
  <p>Appropriate tables are in my SQL Server Database and login works like a charm :)</p>
  
  <p>Once logged in, I want to retrieve some user data and store it in session for later use.  To do this, I intend on passing the username through a Stored Procedure in my database.
  I have tried the following but now when I try to authenticate, nothing happens &amp; the page refreshes.</p>
  
  <pre><code>&lt;asp:Login ID="LoginForm" runat="server"
      DestinationPageUrl="~/LoggedIn/TaskPanel.aspx"
      OnAuthenticate="storeUserDetails" &gt;
  &lt;/asp:Login&gt;
  </code></pre>
  
  <p>C#:</p>
  
  <pre><code>protected void storeUserDetails(object sender, EventArgs e)
  {
      Session["accountCustUsername"] = LoginForm.UserName;
      ...
      ...
  }
  </code></pre>
  
  <p>I have also tried putting a Response.Redirect into this method just to see if anything happens, but nothing does.</p>
  
  <p>Am I suppose to use the login template to get an ID for the username textbox? And how would this be done exactly?</p>