---
title: "how can use server side caching in mvc ?"  
description: "how can use server side caching in mvc ?"  
author: "Anonymous User"  
published: 2019-07-06  
updated: 2019-07-06  
canonical: https://www.mindstick.com/forum/55142/how-can-use-server-side-caching-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc", "mvc", "mvc3", "mvc2", "mvc4", "mvc5"]  
reading_time: 1 minute  

---

# how can use server side caching in mvc ?

example is [required](https://www.mindstick.com/forum/160269/what-is-required-data-annotation-how-does-it-affect-model-validation)

## Replies

### Reply by Anonymous User

If we want to use cache for static contents, then we have to define a few configurations in our application's Web.Config file as below. Here you can see, we have defined the file extension with mime type which needs to be cache. To defining age of caching time, we use "cacheControlMaxAge" attribute from "clientCache" and define the time here. For this demonstration, we have used 1 minute.

```
<system.webServer>
    <staticContent>
      <clear/>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:01:00" />
      <mimeMap fileExtension=".jpg" mimeType="image/jpg"/>
      <mimeMap fileExtension=".png" mimeType="image/jpg"/>
      <mimeMap fileExtension=".css" mimeType="text/css"/>
      <mimeMap fileExtension=".js" mimeType="text/javascript"/>
    </staticContent>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
</system.webServer>
```

For more information, please follow the given below links :

[https://www.mindstick.com/articles/126234/caching-concept-in-asp-dot-net-mvc](https://www.mindstick.com/articles/126234/caching-concept-in-asp-dot-net-mvc)


---

Original Source: https://www.mindstick.com/forum/55142/how-can-use-server-side-caching-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
