public static void AddCookie(string key, Dictionary<string,string> values, DateTime? expiryDate, string domain)
{
HttpCookie httpCookie = new HttpCookie(key);
foreach (KeyValuePair<string, string> value in values)
httpCookie.Values.Add(value.Key, value.Value);
if (expiryDate.HasValue)
httpCookie.Expires = expiryDate.Value;
if (!String.IsNullOrEmpty(domain))
httpCookie.Domain = domain;
HttpContext.Current.Response.Cookies.Add(httpCookie);
}