title: Using Custom MembershipProvider without a Login control in ASP.NET
body: <p>We have got a custom <code>MembershipProvider</code> in <code>ASP.NET</code>. Now there are 2 possible scenario the user can be validated:</p>
  
  <ol>
  <li><p>User login via <code>login.aspx</code> page by entering his username/password. I have used <strong>Login control</strong> and linked it with the <code>MyMembershipProvider</code>. This is working perfectly fine.</p></li>
  <li><p>An authentication token is passed via some URL in query string form a different web sites. For this I have one overload in <code>MembershipProvider.Validate(string authenticationToken)</code>, which is actually validating the user. In this case we cannot use the <strong>Login control</strong>. Now how can I use the same <code>MembershipProvider</code> to validate the user without actually using the <strong>Login control</strong>? I tried to call <code>Validate</code> manually, but this is not signing the user in.</p></li>
  </ol>
  
  <p>Here is the code snippet I am using </p>
  
  <pre><code>if (!string.IsNullOrEmpty(Request.QueryString["authenticationToken"])) {
      string ticket = Request.QueryString["authenticationToken"];
      MyMembershipProvider provider = Membership.Provider as MyMembershipProvider;
      if (provider != null) {
          if (provider.ValidateUser(ticket))
              // Login Success
          else
              // Login Fail
      }
  }
  </code></pre>