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

Page Life Cycle in ASP.NET

2 Answers   Syntel,


what are partial classes and their use?

3 Answers   Microsoft,


IN an ASP.NET Web application if there is any error, how can you debug?

0 Answers   Siebel,


What is different in .net 1.1 and .net 2.0?

0 Answers  


what is value type to reference type

6 Answers   AG Technologies, IBM,






How to you can limit Access to Web API to Specific HTTP Verb?

0 Answers  


Explain the difference between value type and reference type?

0 Answers  


What are the main requirements for caching?

0 Answers  


In a page I have gridview with options of select and delete using hyperlink when I am selecting any one of then it has to open another page how can it?

0 Answers  


Explain what is event bubbling?

0 Answers  


What does uri mean?

0 Answers  


What is s2s tracking?

0 Answers  


Categories