I am trying to do this, and it leads to result with contentlen 0
It looks like:
[OutputCache(Duration = 36000)]
public JsonResult GetFileClasses()
{
return this.Json(TopicConfig.FileExtensionsSettings.List)
}
Any ideas?
The output cache enables you to cache the content returned by a controller action. That way, the same content does not need to be generated each and every time the same controller action is invoked. Imagine, for example, that your ASP.NET MVC application displays a list of database records in a view named Index.
In ASP.NET MVC, there is an OutputCache filter attribute that you can apply and this is the same concept as output caching in web forms. The output cache enables you to cache the content returned by a controller action. Output caching basically allows you to store the output of a particular controller in the memory.
The output cache is located on the Web server where the request was processed. This value corresponds to the Server enumeration value. The output cache can be stored only at the origin server or at the requesting client. Proxy servers are not allowed to cache the response.
NET Framework, caching was available only in the System. Web namespace and therefore required a dependency on ASP.NET classes.
In OutputCacheAttribute
you must also specify , VaryByParam
parameter. Otherwise you'll get this exception on result processing System.Web.HttpException: The directive or the configuration settings profile must specify the 'varyByParam' attribute.
You can try to add this parameter and see if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With