How do you create a permanent cookie?

Answers were Sorted based on User's Feedback



How do you create a permanent cookie?..

Answer / surya beniwal

write this cod on submit button : ..........

HttpCookie objCookie = new HttpCookie("UserCookie");
objCookie.Values.Add("UserName", TextBox1.Text);
objCookie.Values.Add("UserPass", TextBox2.Text);

//for permanent cookie .......
objCookie.Expires = DateTime.MaxValue;

Response.Cookies.Add(objCookie);

Response.Redirect("Default2.aspx");

Is This Answer Correct ?    7 Yes 1 No

How do you create a permanent cookie?..

Answer / vimal

by setting the expiry property greater than
datetime.minvalue.....

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

How .net CLR works with n-tier application

4 Answers   HCL, Hughes,


Types of values mode can hold session state in web.config ?

1 Answers   Accenture, Parrot Systems,


How to manage different kinds of sessions in ASP.NET?

0 Answers   Cap Gemini,


what is diffrence between debug class and trace class in asp.net ?

2 Answers  


How To Send Value one page to Another Page On MasterMenu Click ? please Tell Me!

3 Answers   Accenture,






How to kill more than one session variables at a time

9 Answers   iSoft,


About Usage of server variables ?

2 Answers   Cognizant, CTS,


How do you do client-side validation in .net? How to disable validator control by client side javascript?

0 Answers  


What are the features that make asp.net more used framework? : asp.net mvc

0 Answers  


How can we update records in gridview?Is there any appropriate code for it?

0 Answers  


what is impersonation in ASP.NET?

7 Answers   Accenture, Merrill Lynch, Wipro,


Explain the difference between web user control and web custom control?

0 Answers  


Categories