Search code examples
asp.netquery-stringmembership

ASP.net Authenticate with URL params in addition to Membership Provider


My current ASP.net 3.5 site uses a Membership Provider to manage authentication for the entire site defined in the web.config.

I want to provide an additional method to authenticate by passing user params in the URL

ex. http://site.com?user=foo&pass=bar

What is the best method to achieve this, also this must be able to be invoked before the default authentication is invoked which is the problem I am running into now.


Solution

  • Got it. Authentication redirects to Login.aspx. From there I can get the params from the ReturnURL

    Then

    //Check if Login Params are being sent via the URL
    string user = Request.QueryString["user"];
    string pass = Request.QueryString["pwd"];
    if ((user != null) && (pass != null))
    {
         this.Authenticate(user, pass);
    }
    //else continue with normal login method/form...