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 to compare two strings with out Case sensitive ?

4 Answers   Protech, ProtoTech,


What?s the difference between Response.Write() andResponse.Output.Write()?

7 Answers   Atos Origin, IBM,


How can we pass info between 2 asp.net pages?

0 Answers  


I have a method written in WebForm (means .aspx page) & now I want to call this method in WebUserControl (means .ascx page) what should I have to do?

1 Answers   Patni,


In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?

0 Answers   HCL,






What are the Types of session management in ASP.NET

0 Answers   Microsoft,


What is the difference between mvc and asp.net? : Asp.Net MVC

0 Answers  


What is the difference between Debug.Write and Trace.Write? When should each be used?

2 Answers   Infosys,


what is value type to reference type

6 Answers   AG Technologies, IBM,


Why and where this web.config file is used?

0 Answers   Amazon,


How do I send e-mail from an ASP.NET application ?

1 Answers  


Which namespace do the classes, allowing you to support COM functionality, are located?

1 Answers  


Categories