1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Username/Password Form and Session Cookies for Multiple Users

Discussion in 'C#' started by tc4200, Dec 1, 2006.

  1. #1
    Hello,

    I am trying to setup a log-in screen and am having trouble figuring out how to set the session cookie. I found the bit of code below, and it works if I enter a specific 'email' and 'password' into the "if" statement, however we have multiple users logging into the section. How can I set it up so that if the form is successfully submitted using any of the multiple email/password combos then it creates the session?

    Example found...
    <%
    Username=Request.Form("email")
    Password=Request.Form("Password")
    If email="emailaddress" AND Password="password" Then
    Session("Loggedin")=True
    End If
    %>

    I am new to asp and I really appreciate your help!!
     
    tc4200, Dec 1, 2006 IP
  2. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #2
    hi,

    You can either code a script to search for the user/pass in a data base or you can use the following:

    <%
    Username=Request.Form("email")
    Password=Request.Form("Password")
    If (email="emailaddress" AND Password="password") OR (email="emailaddress2" AND Password="password2") OR (email="emailaddress3" AND Password="password3") Then
    Session("Loggedin")=True
    End If
    %>
     
    Talker, Dec 5, 2006 IP