From a quick search on Stack Overflow I saw people suggesting the following way of checking if a cookie exists:
HttpContext.Current.Response.Cookies
public static class CookieHelper
{
///
/// Checks whether a cookie exists.
///
/// A CookieCollection, such as Response.Cookies.
/// The cookie name to delete.
/// A bool indicating whether a cookie exists.
public static bool Exists(this HttpCookieCollection cookieCollection, string name)
{
if (cookieCollection == null)
{
throw new ArgumentNullException("cookieCollection");
}
return cookieCollection[name] != null;
}
}
Usage:
Request.Cookies.Exists("MyCookie")