IT Community - Software Programming, Web Development and Technical Support

Store and Retrieve the values in cookies in ASP.NET

This is a discussion on Store and Retrieve the values in cookies in ASP.NET within the ASP and ASP.NET Programming forums, part of the Web Development category; Objective: Store and Retieve cookies in ASP.NET Steps: Store and Retieve cookies quite simple in ASP.NET.please follow ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-20-2007, 12:23 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Store and Retrieve the values in cookies in ASP.NET

Objective: Store and Retieve cookies in ASP.NET


Steps: Store and Retieve cookies quite simple in ASP.NET.please follow the below steps

Store values to cookie
----------------------

HttpCookie objCookie = new HttpCookie("Newcookiename");
Response.Cookies.Add(objCookie);
objCookie.Values.Add(cookiename,"2007");
DateTime dtExpiry = DateTime.Now.AddYears(1);
Response.Cookies[cookiename].Expires =dtExpiry;


Retrieve values from cookie
---------------------------
string temp = (Request.Cookies["Newcookiename"].Value) ;

Note:if there is no values in the cookie then it will return null.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to getting values from cookies to set widgets? GDevakii HTML, CSS and Javascript Coding Techniques 1 10-30-2007 02:29 AM
How do I retrieve the values from the URL? Pvinothkumar HTML, CSS and Javascript Coding Techniques 1 09-13-2007 06:30 AM
Store and retrive flash cookies oxygen Flash Actionscript Programming 4 08-22-2007 11:58 PM
how to store and retrieve data from cookies hanusoftware ASP and ASP.NET Programming 1 08-09-2007 07:17 AM
How to Store and Retrieve the values in server side caches in ASP.NET? oxygen ASP and ASP.NET Programming 1 07-23-2007 01:14 AM


All times are GMT -7. The time now is 01:35 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0