Asp.Net Cookies
by
Imran
08/May/2008
|
 |
Asp.Net Cookies Cookies provide a means in Web applications to store user-specific
information. For example, when a user visits your site, you can use
cookies to store user preferences or other information. When the user
visits your Web site another time, the application can retrieve the
information it stored earlier.
Create Cookie
Dim aCookie As New HttpCookie("lastVisit") aCookie.Value = DateTime.Now.ToString() aCookie.Expires = DateTime.Now.AddDays(1) Response.Cookies.Add(aCookie)
Read Cookie
If Not Request.Cookies("userInfo") Is Nothing Then Label1.Text = _ Server.HtmlEncode(Request.Cookies("userInfo")("userName")) End If
|
|
|