Making the cookie's name take the value of the username
I want to create a cookie for every user that logs in my site so that the next time a person attempts to log in, my code will search if a cookie exists for that user based on his username.
How do I write a cookie whose name will take the value of the username? Help!
Mark Hensler posted this at 18:44 — 6th April 2001.
He has: 4,048 posts
Joined: Aug 2000
what language?
val04 posted this at 03:17 — 8th April 2001.
They have: 16 posts
Joined: Mar 2001
I want to know how to make the cookie's name take the value of the username using ASP and JavaScript.
Mark Hensler posted this at 19:09 — 8th April 2001.
He has: 4,048 posts
Joined: Aug 2000
ASP (set cookie)
CookieValue = "logged in"
UserName = request.form("UserName")
Response.Cookies(UserName) = CookieValue
ASP (set session cookie)
CookieValue = "logged in"
UserName = request.form("UserName")
Session(UserName) = CookieValue
Javascript (set cookie)
// cookie expires after 1 month
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+1)
CookieValue = "logged in"
UserName = document.form_name.field_name.value
document.cookie = UserName + "=" + CookieValue + ";expires=" + expireDate.toGMTString()
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.