GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ASP.NET 2.0  |  Question 71 of 161    Print  
How do you create a permanent cookie?

  
Total Answers and Comments: 3 Last Update: August 06, 2009   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 20, 2005 05:04:31   #1  
Shobha Member Since: September 2005   Contribution: 6    

RE: How do you create a permanent cookie?

Setting a permanent cookie is similar to Session cookie except give the cookie an expiration date too. It is very common that you don't specify any arbitrary expiration date but instead expire the cookie relative to the current date using the DateAdd() function.

Response.Cookies( Name ) myCookie
Response.Cookies( Name ).Expires DateAdd( m 1 Now())

 
Is this answer useful? Yes | No
February 07, 2006 09:01:09   #2  
Praveen Kumar        

RE: How do you create a permanent cookie?
Permanent cookies are available until a specified expiration date and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.
 
Is this answer useful? Yes | No
August 05, 2009 07:52:46   #3  
mrp100461 Member Since: January 2008   Contribution: 11    

RE: How do you create a permanent cookie?

<

Response.Cookies("username") "TEXT"

Response.Cookies("username").Expires Date.MaxValue

>


This is the best way because DateAdd is old VB this can work in VB.Net and C#


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape