Login (automatic & manual)

Results 1 to 2 of 2

Thread: Login (automatic & manual)

  1. #1
    Variable Guest

    Default Login (automatic & manual)

    I&#039;m trying to build a site that has a small user-login dialogue in the menue.<BR>Everytime a user logs in (or a new user registers) a cookie should be created on the user computer.<BR>So if the user returns to the site he is automatically logged in and instead of the log in dialogue a picture is displayed (user specific like some other things).<BR><BR>How do I get an asp site to write a cookie on to the user computer and how do I read from it?<BR>It sould work like this.<BR>If cookie = there <BR>get username from cookie and compare with database<BR>get password from cookie and compare with database<BR>if username and password correct <BR>get user preferences from cookie<BR>else show login dialogue<BR>Else<BR>show login dialogue<BR>if entered username and password correct write cookie and get userpreferences<BR>else fo to error<BR><BR><BR>Sorry but I&#039;m using Dreamweaver UltraDev and I have no clue how to do that. <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Login (automatic & manual)

    This is an example without setting up database connections.. The<BR>"username", "password", and "preference" would need to be replaced with the values that you want them to have.<BR><BR><BR>&#039;This is to set a cookie:<BR>Response.Cookie("login")("userid") = "username"<BR>Response.Cookie("login")("passwo rd") = "password"<BR>Response.Cookie("login")("preference ") = "preference"<BR>&#039;Or you could make a seperate cookie for preferences<BR>&#039;A way to get the cookie:<BR>dim username, password<BR>username = Request.Cookie("login")("userid")<BR>password = Request.Cookie("login")("password")<BR>if username = "username" AND password = "password" then<BR> &#039;Do what ever you need to do here if they are correct<BR>else<BR> &#039;Do whatever yo uneed to do here such as redirect to a logon<BR> &#039;page as demonstrated below<BR> &#039;Response.Redirect "login.asp"<BR>end if<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts