---
title: "How to clear cache in ASP.NET MVC?"  
description: "How to clear cache in ASP.NET MVC?"  
author: "Revati S Misra"  
published: 2023-01-20  
updated: 2023-06-04  
canonical: https://www.mindstick.com/forum/157336/how-to-clear-cache-in-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["c#", "asp.net", "asp.net mvc", "mvc", "cache"]  
reading_time: 3 minutes  

---

# How to clear cache in ASP.NET MVC?

Clear maintained [cache](https://www.mindstick.com/blog/222/clearing-cache-in-asp-dot-net) forcefully which [stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) the [website](https://www.mindstick.com/articles/13110/why-copywriting-is-crucial-for-new-website-build) of [users](https://www.mindstick.com/news/2244/issue-preventing-users-from-accessing-facebook-s-social-networking-platforms-has-been-resolved)' data.

## Replies

### Reply by Aryan Kumar

There are a few ways to clear cache in ASP.NET MVC.

## 1. Clear the browser cache

The easiest way to clear cache is to clear the browser cache. This will remove all cached files from the browser, including any cached pages from your ASP.NET MVC application. To clear the browser cache, follow these steps:

1. Open the browser settings.
2. Click on the "Advanced" tab.
3. Under the "Browsing" section, click on the "Clear browsing data" button.
4. Select the "Cache" checkbox and click on the "Clear data" button.

## 2. Clear the output cache

You can also clear the output cache for a specific controller action or for the entire application. To clear the output cache for a specific controller action, use the [OutputCache] attribute. The [OutputCache] attribute allows you to specify the duration of the cache, the location of the cache, and other options. For example, the following code will cache the output of the Home controller action for 10 minutes:

Code snippet

```plaintext
[OutputCache(Duration = 10)]
public ActionResult Home()
{
    // ...
}
```

To clear the output cache for the entire application, you can use the following code:

Code snippet

```plaintext
void Application_Start()
{
    Response.Cache.RemoveAll();
}
```

## 3. Clear the memory cache

The memory cache is used to store frequently accessed data in memory. This can improve performance by reducing the number of times that data needs to be retrieved from the database or other slow data sources. To clear the memory cache, you can use the following code:

Code snippet

```plaintext
void Application_Start()
{
    Cache.Clear();
}
```

## 4. Use a cache clearing tool

There are a number of third-party tools that can be used to clear cache in ASP.NET MVC. These tools can be useful for clearing large amounts of cache or for clearing cache from multiple servers.

Here are some of the popular cache clearing tools:

- **ASP.NET MVC Cache Cleaner**
- **IIS Cache Invalidate**
- **WCAT**

### Reply by Amrita Bhattacharjee

## Hi,

**To answer this specific question,first of all we need to know that cache is specific object type in ASP.NET.We can use or implement several methods for removing cache but the most easy way would be the using of following syntax-**

var staleItem = Url.Action('Action', “YourController”, **new**

{

Id = model.Id,

area = 'areaname';

});

Response.RemoveCacheItem(staleItem);


---

Original Source: https://www.mindstick.com/forum/157336/how-to-clear-cache-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
