How to create a permanent cookie?
And I am using Asp.Net 2.0

Recommended Answers

All 3 Replies

I found this:

How do you create a permanent cookie?

Posted in ASP.Net Interview Questions

If u want a cookie which never expires set it's "Expires" property equal to "DateTime.maxValue". Example:

<%
Response.Cookies("username") = "you"
Response.Cookies("username").Expires = Date.MaxValue 
%>

Cookie is like a temporary file which contains a name and a
value pair and resides in the client.
You can set the permanent cookied by setting the expiry
date to the MaxDate
<%
Response.Cookies("username") = "you"
Response.Cookies("username").Expires = Date.MaxValue
%>

Welcome jitu4you2001.

We appreciate your help. Please do not resurrect old threads. If you want to ask question, start your own thread.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.