Modify expire date of a cookie
Advertisements
| Top Tutorials | New Tutorials | Submit | Login | Register |
Tutorial Detail
Modify expire date of a cookie
To create cookies in ASP is so easy. After creating cookies, you will store it in clients visitors.http://www.devtutorials.info/articles/1036_How_to_modify_expire_date_of_a_cookie.asp
Total Hits: 2706
Total Votes: 25 votes
Category: ASP/Cookies and Sessions
Submitted on: 2008-03-05 05:54:23
Submitted By: Devesh Khanna
Description:
When you create a cookies without modifying expire date, cookies can live until client's bworse closed.For example:
<%
1. Response.Cookies("siteName")= "DevTutorials"
2. siteName = Response.Cookies("siteName")
3. response.write ("Site Name is :" & siteName & vbnewline)
%>
Now open your favorite browser (mine is Firefox :) ) and call cookie's page. Reload page after closing bworer but delete the (1) line. You will see that site name is displaying nothing. Because we did not modify expire date of cookie and we've lost it.
Let's add a expiration date to our code.
<%
0. Response.Cookies(("siteName").Expires= Now()+15
1. Response.Cookies("siteName")= "DevTutorials"
2. siteName = Response.Cookies("siteName")
3. response.write ("Site Name is :" & siteName & vbnewline)
%>
Reload page a few times after closing bworser. You will see that your cookies is alive. More detail...
Rating Detail
| Stars | Percentage | Total Vote |
|---|---|---|
![]() |
![]() ![]() 16% |
4 |
![]() ![]() |
![]() ![]() 16% |
4 |
![]() ![]() ![]() |
![]() ![]() 16% |
4 |
![]() ![]() ![]() ![]() |
![]() ![]() 16% |
4 |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() 20% |
5 |





16%

16%

16%

16%

20%