Simple Admin Login?

Last post 12-09-2007 10:47 AM by pkellner. 1 replies.

Sort Posts:

  • Simple Admin Login?

    12-09-2007, 7:41 AM

    Guys can anyone explain how to create a simple admin login feature.

     Please include whether or not I would need to construct a DB to accompany this process and also the concept behind the coding.

     

    Or just link meto a neccessary tutorial.

     

    Thanks guys!
     

  • Re: Simple Admin Login?

    12-09-2007, 10:47 AM
    Answer
    • All-Star
      23,809 point All-Star
    • pkellner
    • Member since 11-12-2004, 5:42 AM
    • San Jose, California
    • Posts 3,573
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    you can do it without a database very easily.  Here is an example of using the login control.

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (FormsAuthentication.Authenticate(Login1.UserName, Login1.Password))
            {
                e.Authenticated = true;
            }
            else
            {
                e.Authenticated = false;
                //FormsAuthentication.SetAuthCookie(Login1.UserName, true);
            }
        }

    web.config

     

    <authentication mode="Forms">
    <forms loginUrl="login.aspx" protection="All" timeout="30">
    <credentials passwordFormat="Clear">
    <user name="pkellner" password="pass1"/>
    <user name="someguy" password="password"/>
    </credentials>
    </forms>
    </authentication>
    <authorization>
    <allow users="*"/>
    </authorization>

    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
Page 1 of 1 (2 items)