How do you create a permanent cookie?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain diff. Betn dataset and recordset?

524


What are triggers of an updatepanel?

532


Using code explain Configuration Management

1386


Define authentication and authorization.

598


How to automatically get the latest version of all the asp.net solution items from source safe when opening the solution?

503






Explain the steps to be followed to use passport authentication.

563


What is bson in web api?

570


What is the use of worker process in asp.net?

508


What are the advantages and limitations of query string?

543


What is the difference between the response.write() and response.output.write() methods?

491


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

465


Explain different types of Caching techniques in ASP.NET?

532


1.What r collections? 2.What is .pdb file? 3.Is it possible to provide access to users in master page? 4.What is dirty n Phantom Read(SQL)? 5.What r different isolation levels(SQL)? 6.How to set authentication mode in web.config file?

1762


What are the navigation ways between pages available in ASP.NET?

547


What is cache in asp net?

509