Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove cookies from browser

how to remove cookies from browser in asp.net c#

like image 982
leonyx Avatar asked May 12 '10 06:05

leonyx


People also ask

How do I delete cookies in Internet Explorer?

To delete cookies 1 In Internet Explorer, select the Tools button, point to Safety, and then select Delete browsing history. 2 Select the Cookies and website data check box, and then select Delete. More ...

How do I clear my browser's cache and cookies?

On your computer, open Chrome. At the top right, click More . Click More tools Clear browsing data. At the top, choose a time range. To delete everything, select All time. Next to "Cookies and other site data" and "Cached images and files," check the boxes.

How to delete cookies and saved passwords in chrome?

To delete cookies in Google Chrome: Select the 3 vertical dots in the upper-right corner of the Chrome screen. Select More Tools > Clear browsing data. Select the Cookies and other site data checkbox. To delete the saved passwords in Chrome, select Passwords and other sign-in data.

How do I clear cookies on Opera browser?

Opera: Clear Browsing Data. The setting to delete cookies in Opera is found in the Clear browsing data part of the browser, which is a section of Settings. On the top right corner, select Easy Setup (Looks like sliders.) Scroll down to the Clear browsing data section and select Clear browsing data.


1 Answers

Here's how.

if (Request.Cookies["MyCookie"] != null)
{
    HttpCookie myCookie = new HttpCookie("MyCookie");
    myCookie.Expires = DateTime.Now.AddDays(-1d);
    Response.Cookies.Add(myCookie);
}
like image 166
Fenton Avatar answered Sep 30 '22 05:09

Fenton