// given a cookie name ckName, get its value from CookieCollection cookies public bool getCookieVal(string ckName, ref CookieCollection cookies, out string ckVal) { //string ckVal = ""; ckVal = ""; bool gotValue = false; foreach (Cookie ck in cookies) { if (ck.Name == ckName) { gotValue = true; ckVal = ck.Value; break; } } return gotValue; }