title: Problems in aspnet membership provider
body: <p>I am using asp.net memebership </p>
  
  <p>I log out the applcation by writting this code for log out </p>
  
  <pre><code>if (Membership.GetUser(HttpContext.Current.User.Identity).IsOnline) ;
  {
      FormsAuthentication.SignOut();
  
      Response.Redirect(FormsAuthentication.LoginUrl);
  }
  Response.Redirect("loginpage.aspx");
  </code></pre>
  
  <p>After then I started the application and gettig the error in code block of authetication .below I am writtng a code and error message </p>
  
  <pre><code>else if (User.Identity.IsAuthenticated == true &amp;&amp; Membership.GetUser( Membership.FindUsersByName(User.Identity.Name)).IsOnline==true)
  {
      FormsAuthentication.SignOut();
      FormsAuthentication.RedirectToLoginPage();
      MembershipUser currUser = null;
  
      string gt = null;
      if (HttpContext.Current.User != null)
      {
          currUser = Membership.GetUser(true);
          gt = currUser.Email;
      }
  
      /// string temp = User.Identity.GetProfile().ID;
      //string query = "Insert into user_tbl(MemberID)(" + temp + ")";
      //Response.Redirect("UserPanel.aspx");
      //return;
  }
  </code></pre>
  
  <p>here <code>Membership.FindUsersByName(User.Identity.Name)).IsOnline==true)</code>  I am getting this error </p>
  
  <blockquote>
    <p>[ArgumentException: The provider user key supplied is invalid.  It
    must be of type System.Guid. Parameter name: providerUserKey]</p>
  </blockquote>
  
  <p>I am unable to find what to do , I debug the application and found User.Identity.Name as a <code>hash value</code> </p>
  
  <pre><code>Stack Trace 
  Exception Details: System.ArgumentException: The provider user key supplied is invalid.  It must be of type System.Guid.
  Parameter name: providerUserKey
  
  Source Error: 
  
  
  Line 86:             }
  Line 87: 
  Line 88:             else if (User.Identity.IsAuthenticated == true &amp;&amp; Membership.GetUser( Membership.FindUsersByName(User.Identity.Name)).IsOnline==true)
  Line 89:             {
  Line 90:                 
  
  Source File: d:\31 May 2012\Demo\LoginPage.aspx.cs    Line: 88 
  
  Stack Trace: 
  
  
  [ArgumentException: The provider user key supplied is invalid.  It must be of type System.Guid.
  Parameter name: providerUserKey]
     System.Web.Security.SqlMembershipProvider.GetUser(Object providerUserKey, Boolean userIsOnline) +2242996
     System.Web.Security.Membership.GetUser(Object providerUserKey, Boolean userIsOnline) +40
     System.Web.Security.Membership.GetUser(Object providerUserKey) +6
     LoginPage.Page_Load(Object sender, EventArgs e) in d:\31 May 2012\Demo\LoginPage.aspx.cs:88
     System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
     System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +36
     System.Web.UI.Control.OnLoad(EventArgs e) +92
     System.Web.UI.Control.LoadRecursive() +54
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
  </code></pre>