title: Cookie is not deleted
body: <p>I am using the following code to set a cookie in my asp.net mvc(C#) application:</p>
  
  <pre><code>public static void SetValue(string key, string value, DateTime expires)
  {
      var httpContext = new HttpContextWrapper(HttpContext.Current);
      _request = httpContext.Request;
      _response = httpContext.Response;
  
      HttpCookie cookie = new HttpCookie(key, value) { Expires = expires };
      _response.Cookies.Set(cookie);
  }
  </code></pre>
  
  <p>I need to delete the cookies when the user clicks logout. The set cookie is not removing/deleting with Clear/Remove. The code is as below:</p>
  
  <pre><code>public static void Clear()
  {
      var httpContext = new HttpContextWrapper(HttpContext.Current);
      _request = httpContext.Request;
      _response = httpContext.Response;
  
      _request.Cookies.Clear();
      _response.Cookies.Clear();
  }
  
  public static void Remove(string key)
  {
      var httpContext = new HttpContextWrapper(HttpContext.Current);
      _request = httpContext.Request;
      _response = httpContext.Response;
  
      if (_request.Cookies[key] != null)
      {
          _request.Cookies.Remove(key);
      }
      if (_response.Cookies[key] != null)
      {
          _response.Cookies.Remove(key);
      }
  }
  </code></pre>
  
  <p>I have tried both the above functions, but still the cookie exists when i try to check exist.</p>
  
  <pre><code>public static bool Exists(string key)
  {
      var httpContext = new HttpContextWrapper(HttpContext.Current);
      _request = httpContext.Request;
      _response = httpContext.Response;
      return _request.Cookies[key] != null;
  }
  </code></pre>
  
  <p>What may be problem here? or whats the thing i need to do to remove/delete the cookie?</p>