title: Membership.GetUser().ProviderUserKey always returns null
body: <p>I've recently started using ASP.NET Forms Authentication and Membership.</p>
  
  <p>I created a C# project in Visual Studio, which automatically created pages like "/Account/Login.aspx".</p>
  
  <p>I then followed an example for installing <code>aspnet_*</code> tables to my SQL Server database, and I've been able to use the <code>&lt;asp:CreateUserWizardStep&gt;</code> control to create a user.</p>
  
  <p>I've then been able to login as this user, and the logged in username appears when calling <code>&lt;asp:LoginName&gt;</code></p>
  
  <p>However, when I call the following in my C# code, in a Button Click Event Handler, I always get a Null Reference Exception:</p>
  
  <pre><code>string UserID = Membership.GetUser().ProviderUserKey.ToString();
  </code></pre>
  
  <p>Shouldn't this return the <code>UserID</code> from my aspnet_users table?</p>
  
  <p>If <code>&lt;asp:LoginName&gt;</code> is showing a UserName value, shouldn't I always be able to call <code>Membership.GetUser().ProviderUserKey</code></p>