Created
January 2, 2014 22:19
-
-
Save PilotBob/8228138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult SetCookies() | |
{ | |
Response.Cookies.Add(new HttpCookie("Cookie1", "Test 1")); | |
Response.Cookies.Add(new HttpCookie("Cookie2", "Test 2")); | |
Response.Cookies.Add(new HttpCookie("Cookie3", "Test 3")); | |
return View("Index"); | |
} | |
public ActionResult DeleteCookies() | |
{ | |
foreach (var cookie in Request.Cookies.AllKeys) | |
{ | |
var newCookie = new HttpCookie(cookie); | |
newCookie.Expires = DateTime.Now.AddDays(-1D); | |
Response.Cookies.Add(newCookie); | |
} | |
return View("Index"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment