.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Storing and retriving user information from cookie

Posted By: priya     Posted Date: August 05, 2010    Points:2   Category :ASP.Net
Hi,

Can any one give me the code for how to store and retrieve user information from cookies?

Thanks
Priya

Responses
Author: Sunil Yadav       [Moderator]      
Posted Date: August 06, 2010     Points: 5   

Hi,

// Storing user data in cookie
HttpCookie cookie = new HttpCookie("user");
Response.Cookies.Clear();
cookie.Values["userName"] = "sunil";
cookie.Expires = DateTime.Now.AddMinutes(30);
Response.Cookies.Add(cookie);

//Reading Cookie
string cookievalue = Server.HtmlEncode(Request.Cookies["user"].Values["username"]);


Author: Nikhil Kumar             
Posted Date: August 07, 2010     Points: 5   

just see my article on cookies... may you'll get what you want.

http://www.dotnetspark.com/kb/1384-cookies-asp-net.aspx

Thnx !!!

Be helpful and enjoy life because it comes only onces. Give all the happiness to yours and remember it doesn't comes by money ...


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend