title: How to delete cookie from .Net
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7079565/delete-cookie-on-clicking-sign-out">Delete cookie on clicking sign out</a>  </p>
  </blockquote>
  
  
  
  <p>I want to delete cookies when the user logout. </p>
  
  <p>Here is my code:</p>
  
  <pre><code> if (HttpContext.Current.Request.Cookies["currentUser"] != null)
   {
       DeleteCookie(HttpContext.Current.Request.Cookies["currentUser"]);
   }
  
  
         public void DeleteCookie(HttpCookie httpCookie)
          {
              try
              {
                  httpCookie.Value = null;
                  httpCookie.Expires = DateTime.Now.AddMinutes(-20);
                  HttpContext.Current.Request.Cookies.Add(httpCookie);
              }
              catch (Exception ex)
              {
                  throw (ex);
              }
          }
  </code></pre>
  
  <p>But it doesn't work. Do you have any suggestion? </p>