Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created October 16, 2012 17:48
Show Gist options
  • Save dcabines/3900841 to your computer and use it in GitHub Desktop.
Save dcabines/3900841 to your computer and use it in GitHub Desktop.
CookieHelp
using System;
using System.Web;
using System.Collections.Specialized;
namespace WebData {
public static class CookieHelp {
public static void Add(string name, DateTime expiration, NameValueCollection data) {
var cookie = new HttpCookie(name) {Expires = expiration};
foreach (string key in data.Keys) cookie[key] = data[key];
HttpContext.Current.Response.Cookies.Add(cookie);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment