Hi everybody,
it's been a long time I haven't posted any message on the forum. Here is my problem : I have a connecting page attached. The user must enter his login and his pasword. What i'd like to do is to keep in memory these information. I heard that I could cookies to do that. Can you tell me what are they and the most important how to use it in asp. If you have code samples, they're welcome. Do I have to use two cookies, one for the login and one for the password ?
Thanks in advance for your help
take care
constance
To set a cookie you can use:-
response.cookies("cookiename")("dataname")="data"
and to retrieve you can use:-
request.cookies("cookiename")("dataname")
Hope that helps
Was this answer helpful ?
Yes No
thanks richyrich i'll try that
Was this answer helpful ?
Yes No
Cookies are little text files that are stored on the client computer. In ASP they are accessed through the request (to read) object and response (to write) object.
The basic syntax is as follows
Code:
' To read a cookie
strUserName = request.cookies("loginDetails")("userName")
strPassword = request.cookies("loginDetails")("password")
' To write a cookie
response.cookies("loginDetails")("userName") = strUsername
response.cookies("loginDetails")("password") = strPassword
response.cookies("loginDetails").expires = dateAdd("m", now(), 3)
A cookie will by default expire (be deleted from the client computer) when the browser closes, so by setting the expires property we can override that. In the example above the cookie will live for three months.
Also remember that cookies can be turned off by a user.
Hope this helps
Was this answer helpful ?
Yes No
Was this answer helpful ?
Yes No
Quote:
| Originally Posted by elijathegold Beat me to it  |
Sorry...
Having a dull day at work...

Was this answer helpful ?
Yes No
Was this answer helpful ?
Yes No
Was this answer helpful ?
Yes No
Was this answer helpful ?
Yes No
To create a cookie in ASP, use the following format:
Code:
Response.Cookie("myCookie") = "testData"
To read a cookie
Code:
Request.Cookie("myCookie")
But the very nice thing is that you can use keys in cookies.
Code:
Response.Cookie("myCookie")("1stKey") = "testData1"
Response.Cookie("myCookie")("2ndKey") = "testData2"
One cookies, multiplem keys
Was this answer helpful ?
Yes No