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

What is custom events? How to create it?

619


Explain different authentication modes in asp.net?

548


What is smpte vc-1?

549


What is server infrastructure & server components?

780


Define the steps to set up validation control.

576






What are the different method of navigation in asp.net?

563


What is parse in asp.net?

550


What is the adavantage of using ASP.NET routing?

644


How to use a Master Database in Asp.net?

561


What is session handling in a webfarm, how it can work with its limits?

621


can s/w quality assurance engineer switch field to programming side i m very much interested in programming but not much good in it

1417


What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?

742


What is the use of HttpHandlers? When to use this?

623


What is a 401 redirect?

505


How Can assign alias name for ASP.NET Web API Action?

934