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 do you associate two or more validators with a single input control? What do you need to do to prevent space from being reserved for a validation control thatpasses its validation test?

1 Answers  


What is session management in web application?

0 Answers  


What is the difference between ASP.NET Webforms and ASP.NET MVC?

0 Answers  


Explain asp.net application life cycle?

0 Answers  


Where do you store the information about the user?s locale?

1 Answers  






I am trying to redirect another site on button click.

8 Answers  


Have you used microsoft dataaccess blocks and Exception blocks?

1 Answers   Microsoft,


How can you get public key information?

1 Answers   Microsoft,


when using personlization, how do you access over setting at runtime?

1 Answers  


What are the different Key TreeView Properties in Asp.net 2.0?

1 Answers   TCS,


Can we use multiple web.config files in an sigle appliction?

3 Answers   IBS,


Difference between server.Execute and response.redirect ?

5 Answers   Accenture, Keane India Ltd,


Categories