ASP.NET How to Use Cookies
Cookies Description
Cookies are tiny files that are created on your computer or in your browser browser memory (if temporary). Cookies give you a way to store information across multiple http requests and responses or even sessions. Cookies store information in plain text format. Here is a good article on cookies: Beginner’s Guide to ASP.NET Cookies
Retrieve:
Click on Copy Code to Cut-n-paste code
HttpCookie _userInfoCookies; _userInfoCookies = Request.Cookies["GWcookie"]; if (_userInfoCookies != null) { strOotid = _userInfoCookies["Ootid"]; } |
Set Cookie:
Click on Copy Code to Cut-n-paste code
HttpCookie _userInfoCookies; //Creating a Cookie Object _userInfoCookies = new HttpCookie("GWcookie"); //Setting values inside it _userInfoCookies["LanguageCode"] = myLanguage; //Adding Expire Time of cookies _userInfoCookies.Expires = DateTime.Now.AddDays(5); |
Location of cookies:
C:\Users\wharvey\AppData\Roaming\Microsoft\Windows\Cookies
