-2

i'm trying to remove cache without restart the browser with asp.net C# code. this is my code

HttpCookie myCookie = new HttpCookie("email_address");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);

HttpCookie tenantcookie = new HttpCookie("tenant_id");
tenantcookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(tenantcookie);

HttpCookie access_token = new HttpCookie("access_token");
access_token.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(access_token);

The cache has been deleted, but I have to close my browser and open my browser again to show see if the cache has been delete or not.

Any suggestions?

dcastro
  • 66,540
  • 21
  • 145
  • 155
Ogan Tobing
  • 21
  • 1
  • 3

1 Answers1

0

Because of security reasons you can't clear a browser's history using code.

You can delete all files and folders under browsers cache directory, This is the default cache location for

  • mozilla-"C:\Documents and Settings\%username%\Local Settings\Application Data\Mozilla\Firefox\Profiles\xxxxxxx.xxxx"
  • chrome="\AppData\Local\Google\Chrome\User Data\Default\Cache."

It is hidden and you change view from folder option.

Rashad Valliyengal
  • 3,132
  • 1
  • 25
  • 39