creating a new cookie

C

collie

Hi,

I have an asp page where i created cookies-for admin and for user. The
aspx page reads these cookies. Everything seems to work fine but now i
have to create a new cookie if cookie has expired or if cookie is
null. Also, i am having problems with the expire because if the
username belongs to the admin for example and then i want to change
the username that belongs to a normal user the cookie recognises the
first (admin) cookie. How do i solve this?
Thanks
if ACCESS="user" then
'--create user cookie
Response.Cookies("UserCookie")("Username") =
Request.Form("UserName")
Response.Cookies ("UserCookie")("Password")=Request.Form
("Password")
Response.Cookies("UserCookie").Path = "/"
Response.Cookies ("UserCookie").expires = DateAdd("d", Date, 14)
Response.Write(Request.Cookies("UserCookie")("Username"))
Response.Write (Request.Cookies("UserCookie")("Password"))

'---end user cookie
else
'create admin cookie

Response.Cookies("adminCOOKIE")("ADMINusername") =
Request.Form("UserName")
Response.Cookies ("adminCOOKIE")("ADMINPassword")=Request.Form
("Password")
Response.Cookies("adminCOOKIE").Path = "/"
Response.Cookies ("adminCOOKIE").expires =dateadd("m",20,now())
Response.Write(Request.Cookies("adminCOOKIE")("ADMINusername"))
Response.Write (Request.Cookies("adminCOOKIE")("ADMINPassword"))

'---end admin cookie
end if
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top