outputcache

How to get fresh copy if OutputCache(Location = OutputCacheLocation.Downstream is used

时光怂恿深爱的人放手 提交于 2019-12-24 18:43:17
问题 Mono MVC2 application uses controller below to cache order page in browser. If F5 is pressed in browser, old page is still returned to browser. How to return fresh page if F5 is pressed ? It looks like page is cached in server but OutputCacheLocation.Downstream must cache page only in borwser. Is this bug? [Authorize] public class DetailController : ControllerBase { [OutputCache(Location = OutputCacheLocation.Downstream, Duration = 20 * 60,VaryByParam = "_entity")] public ActionResult Index

Should I output cache my control that looks up twitter RSS onload?

ε祈祈猫儿з 提交于 2019-12-24 12:28:26
问题 I have a user control that is featured on several pages of a heavily hit site. Some of these pages include our blog sidebar, our forum sidebar, and smack right in the middle of our home page. That means this control is rendered a lot. The control it meant to read in a twitter RSS feed for a specific account and write out the last 2 tweets. Below is the majority of my Page_Load for the control. I have it in a try {} catch because it seems that on production the site is unable to load the XML

Ignore url values with Outputcache

こ雲淡風輕ζ 提交于 2019-12-24 10:27:46
问题 When I use outputcaching on an action method it is cached by full url, what i would like to do is cache the page but ignore some parts of the url. Custom route defined in Global.asax: routes.MapRoute( "Template", "Report/{reportid}/{reportname}/Template/{templateid}/{action}", new { controller = "Template", action = "Index" } ); My template controller public class TemplateController : Controller { [OutputCache(Duration=60*60*2)] public ActionResult Index(Template template) { /* some code */ }

OutputCache not let to change site language

寵の児 提交于 2019-12-24 07:46:54
问题 I want to use OutputCache to open pages quickly. I wrote in controller: public class HomeController : Controller { [OutputCache(Duration=3600,VaryByParam="none", VaryByCustom="lang")] public ActionResult Index() { //........ } public ActionResult ChangeCulture( string lang, string returnUrl ) { Session["Culture"] = new CultureInfo( lang ); return Redirect( returnUrl ); } } In Layout.cshtml: <a href="@Url.Action( "ChangeCulture", "Home", new { lang = "en", returnUrl = this.Request.RawUrl } )"

Can we cache images, css and java script in MVC3 through Output Cache?

≯℡__Kan透↙ 提交于 2019-12-24 03:56:07
问题 Can we cache images, css and javascript of any specific view (not partial view) in MVC3 through OutputCache attribute. like I want to cache my Home Controller view.I tried this but only contents are cached not images and css. 回答1: Instead of Output Cache attribute you can use following methods to have caching of static resources: 1.Using max-age. Put below section in web.config in <configuration> -> <system.webServer> section <staticContent> <!-- Tell client to cache static files for a year -

Where is my max-age header coming from?

丶灬走出姿态 提交于 2019-12-23 21:35:30
问题 I'm well aware of how I could set it myself, but I am concerned about having it configured in two different places. To receive the bounty, please tell me where I should look to find the existing setting. Places we've already looked for the existing setting, without success: the web.config <StaticContent> section IIS output caching section, at all three levels: machine site application Code (I did a global search for SetMaxAge ) Context We recently noticed that our CSS and JS files aren't

.NET OutputCache directive not working

青春壹個敷衍的年華 提交于 2019-12-23 13:01:07
问题 I've been having strange cache issues and put together a very simple .NET page with an output cache directive. However, the page is not caching (the content updates on every refresh). I have a simple, minimal site of our CMS (Ektron v. 9.0 SP2) installed on my local machine (Windows 7). Within this website project I created a simple page for testing the output cache. Here is the page code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CacheTest.aspx.cs" Inherits="CacheTest" %> <%@

Cache key length in asp.net

孤街浪徒 提交于 2019-12-23 12:23:19
问题 I was investigating the MVC3 source and came across the following (in OutputCacheAttribute.cs) which is called when generating a key to use for output caching: // The key is typically too long to be useful, so we use a cryptographic hash // as the actual key (better randomization and key distribution, so small vary // values will generate dramtically different keys). using (SHA256 sha = SHA256.Create()) { return Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(uniqueIdBuilder

How to retrieve already cached data inside webapi controller method C#

允我心安 提交于 2019-12-23 05:30:35
问题 I have created a OutputCacheFilter attribute by inheriting ActionFilterAttribute to get the caching functionality for the controller method. This is my OutputCacheFilter class public class OutputCacheFilter : ActionFilterAttribute { // cache length in seconds private int _timespan; // true to enable cache private bool _cacheEnabled = false; // true if the cache depends on the caller user private readonly bool _dependsOnIdentity; // cache repository private static readonly ObjectCache

Disable OutputCache on Development System

╄→尐↘猪︶ㄣ 提交于 2019-12-20 18:00:39
问题 I use OutputCache in an ASP.net MVC application. As developing with an active OutputCache is not very pleasant I want to disable the OutputCache on the Development Systems (local machines and development server). What is the best way to do this? 回答1: It's an old one but... set this in your web.config under system.web <caching> <outputCache enableOutputCache="false" /> </caching> 回答2: The outputcache in ASP.NET can be enabled and disabled using For iis versions < 7.0 <system.web> <caching>