outputcache

How to remove OutputCache on ChildAction?

扶醉桌前 提交于 2019-12-01 02:55:59
问题 I am trying to take advantage of the donut caching features in .Net MVC 3. For my Home page, in my home controller, I have: public ActionResult Index() { return View(); } [ChildActionOnly] [OutputCache(Duration=3600)] public ActionResult IndexMain() { return PartialView(ViewModelRepository.GetIndexViewModel()); } I my view, I have: <% Html.RenderAction("IndexMain");%> This all works fine. However, when the data changes, I run: var urlToRemove = Url.Action("IndexMain", "Home"); Response

Caching strategy, Output Cache vs Data Cache or both?

社会主义新天地 提交于 2019-11-30 13:29:18
I'm working on an ASP.NET MVC project and I've come to the point where I want to start considering my caching strategy. I've tried to leave my framework as open as possible for the use in caching. From what I heard during Scott Hanselman's podcast StackOverflow.com uses page output caching and zips that content and puts it into RAM. This sounds like this would be great for user-wide cache but for something like personalized pages you would have to cache a version for each user and that could get out of control very quickly. So, for a caching strategy. Which should be used, Output Caching, Data

ASP.Net Core 2.0 - ResponseCaching Middleware - Not Caching on Server

折月煮酒 提交于 2019-11-30 09:55:02
I want to use server-side response caching (output cache) with asp.net core 2.0 and found out about Response Caching Middleware and wanted to give it a try with a brand new asp.core mvc project. Here is the description from the link above which makes me think this could be used like output cache. The middleware determines when responses are cacheable, stores responses, and serves responses from cache. Here is how my startup.cs looks like. public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This

Why is output caching not working for my ASP.NET MVC 4 app?

独自空忆成欢 提交于 2019-11-30 08:46:30
I am having an issue where output caching doesn't appear to be working for my ASP.NET MVC 4 (EPiServer 7) website. I have the following output cache profile in my web.config : <caching> <outputCacheSettings> <outputCacheProfiles> <add name="PageOutput" enabled="true" duration="300" varyByParam="*" location="ServerAndClient" /> </outputCacheProfiles> </outputCacheSettings> </caching> And here is my output caching configuration for static resources: <caching> <profiles> <add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" /> <add

How do I use VaryByParam with multiple parameters?

删除回忆录丶 提交于 2019-11-29 21:09:39
In ASP.NET MVC2 I use OutputCache and the VaryByParam attribute. I got it working fine with a single parameter, but what is the correct syntax when I have several parameters on the method? [OutputCache(Duration=30, VaryByParam = "customerId"] public ActionResult Index(int customerId) { //I've got this one under control, since it only has one parameter } [OutputCache(Duration=30, VaryByParam = "customerId"] public ActionResult Index(int customerId, int languageId) { //What is the correct syntax for VaryByParam now that I have a second parameter? } How do I get it to cache the pages using both

ASP.NET MVC - caching pages on client side

梦想与她 提交于 2019-11-29 08:42:24
I have code that is cached this way: [OutputCache(Duration="3600", Location=OutputCacheLocation.Client)] Now, I don't exactly know how this output cache works. Where exactly does it keep the copy of a page? And what are the differences between OutputCacheLocation.Client and OutputCacheLocation.Browser ? Where exactly does it keep the copy of a page? The location of where the cache is stored is determined by Location property of the OutputCacheAttribute . In your case you set Location=OutputCacheLocation.Client so it will keep the cache on the client browser. And what are the differences

Disable caching on a partial view in MVC 3

我只是一个虾纸丫 提交于 2019-11-29 01:14:59
I have an issue with a partial View being cached when it shouldn't be. This partial View is used to display the Logon/Logoff on a page. It uses the simple code below to figure out which link to display @if(Request.IsAuthenticated) { <a href="@Url.Action("LogOff", "Account", new { area = "" })">Log Off</a> } else { <a href="@Url.Action("LogOn", "Account", new { area = "" })">Log On</a> } This partial View is called from with all pages in my MVC3 application, using @Html.Partial("_HeaderView") In most of my controllers, I have the output cache defined, so I can take advantage of caching my

What are difference between IIS (Dynamic and Static) cache,OutPutCache and browser cache

孤者浪人 提交于 2019-11-28 23:52:32
What are difference between IIS (Dynamic and Static) cache, OutPutCache and browser cache ? I think I'm confuse about them. Does browser cache all js or css files? What happend if I use IIS caching and don't use OutputCache ? What happend if I use both? Aristos The OutPutCache is a page/control cache that saved on server to gain processing speed from the render of this page/control. The browser cache is header commands that you set on page and give the instruction to the clients browser to keep the page on clients computer cache for some time and not read it back from the server. The static

Understand If-Modified-Since HTTP Header

空扰寡人 提交于 2019-11-28 23:26:46
I am looking at a Caching library that is trying to use the If-Modified-Since header of a request object. The problem is this header never gets set, it is always blank which makes sense to me seeing how it is a REQUEST. How can you force a request to have a If-Modified-Since header? Or am I way off for what this does. Here is the function I am referring to. public function isNotModified(Request $request) { $lastModified = $request->headers->get('If-Modified-Since'); $notModified = false; if ($etags = $request->getEtags()) { $notModified = (in_array($this->getEtag(), $etags) || in_array('*',

Does VaryByParam=“*” also read RouteData.Values?

余生颓废 提交于 2019-11-28 12:25:21
in my asp.net mvc project, I enable output caching on a controller as below [OutputCache(Duration = 100, VaryByParam = "*", VaryByHeader = "X-Requested-With")] public class CatalogController : BaseController { public ActionResult Index(string seller) { // I do something } } it works great, until create my own Route class as below public class MyRoute : Route { // there is a constructor here.. // I override this method.. // just to add one data called 'seller' to RouteData public override RouteData GetRouteData(HttpContextBase httpContext) { var data = base.GetRouteData(httpContext); if (data =