outputcache

ASP.NET @OuputCache Directive "Inheritance"

Hi to all, As I mention in an earlier question, I am having trouble with the performance of a web site... Some SQL queries are killing the server. But, as the title of this post mention, I looked at the OutputCache page directive to improve performance of the site. Although, I came across some questions regarding this directive: 1- If ...

ASP.NET MVC 2 disable cache for browser back button in partial views

I am using Html.RenderAction<CartController>(c => c.Show()); on my master Page to display the cart for all pages. The problem is when I add an item to the cart and then hit the browser back button. It shows the old cart (from Cache) until I hit the refresh button or navigate to another page. I've tried this and it works perfectly but it...

Controlling ASP.NET output cache memory usage

I would like to use output caching with WCF Data Services and although there's nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms. But I am worried about the worker process getting recycled due to ...

Output Caching - why doesn't it seem to do the job?

Hi, I have quite a big user control which creates an ASP.NET tab menu and within each tab a lengthy set of icons/menus. The menu is dynamically created from the database. I thought I could wrap the user control with an output cache directive to speed things up. I set OutputCache varybyparam="none" and duration to 120 seconds. When I...

ASP.NET MVC OutputCache with POST Controller Actions

I'm fairly new to using the OutputCache attribute in ASP.NET MVC. Static Pages I've enabled it on static pages on my site with code such as the following: [OutputCache(Duration = 7200, VaryByParam = "None")] public class HomeController : Controller { public ActionResult Index() { //... If I understand correctly, I...

Does the ASP.NET OutputCache directive actually cache or just set some Response properties?

Hi folks, When someone uses the OutputCache directive in an ASP.NET WebForms/MVC application, does it actually do any caching server-side, like using the Cache or does it only setup some properties in the Response object like the Cache-Control property? Cheers :) ...

Why does using ASP.NET OutputCache keep returning a 200 OK, not a 304 Not Modified?

Hi folks, i have a simple aspx page. Here's the top of it:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Foo.aspx.cs" Inherits="Foo" %> <%@ OutputCache Duration="3600" VaryByParam="none" Location="Any" %> Now, every time I hit the page in FireFox (either hit F5 or hit enter in the url bar) I keep gettin...

Optimal ASP.Net cache duration for a large site?

I've read lots of material on how to do ASP.Net caching but little on the optimal duration that pages should be cached for. Let's say that I have a popular site with 50,000 pages. The content does not change frequently, so I could cache pages for up to an hour if I wanted. The server has 16 GB of RAM, but database connections are limi...

Output caching in HTTP Handler and SetValidUntilExpires

I'm using output caching in my custom HTTP handler in the following way: public void ProcessRequest(HttpContext context) { TimeSpan freshness = new TimeSpan(0, 0, 0, 60); context.Response.Cache.SetExpires(DateTime.Now.Add(freshness)); context.Response.Cache.SetMaxAge(freshness); context.Response.C...

Is it possible to iterate all the OutputCache keys?

Is it possible to iterate the OutputCache keys? I know you can remove them individually via HttpResponse.RemoveOutputCacheItem(), but is there a way I can iterate all the keys to see what's in the collection? I searched through Object Viewer, but didn't see anything. Worst case, I can maintain my own index. Since I'm doing everything ...

ASP.Net Outputcache programmatically not working in partial view

The following code is not working in a partial view. <% // Pages always expire at midnight. Response.Cache.SetExpires(DateTime.Today.AddHours(24)); if (variable > 0) { Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate); } else { Response.Cache.SetCacheability(HttpCacheability.Public); } %> C...

How can output cache be enabled in SharePoint Foundation?

I am using SharePoint Foundation 2010 and would like to enable output caching for certain pages, or maybe the whole site. On SharePoint Server you have a mechanism to enable page output caching across the site collection (it is actually ASP.NET output cache under the hood). On SPF you don't get that feature - fair enough. So how can I e...

OutputCache not caching for the whole duration time

I made a simple testcase. default.asp: <%=now%> web.config: <?xml version="1.0" encoding="UTF-8"?> <configuration> <location path="default.asp"> <system.webServer> <caching> <profiles> <add extension=".asp" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="01:00:00" varyByQue...

ASP.NET MVC: Filtering/Varying by HTTP Status Code in OutputCache Attribute

In the ASP.NET MVC site that I'm writing, I'm building a generic Error Action that is routed to by an HttpModule, following this tutorial. In this Action, I will return a View corresponding to the status code that is applied to the response inside the HttpModule (after doing this, the module transfers the request over to the Action in qu...

Does outputcaching varybyparams in webforms understand route parameters?

Does outputcaching VaryByParams in webforms understand route parameters? Such that if I have a route similar to "Content/{filename}/{more}" that I could do VaryByParams="filename" and have it return cached results based on filename and ignore any values in the more? ...

ASP.NET recreating cached control

Hi, I solved most of the issues I had with caching. But still there is one thing. I have a UserControl for which I use output caching. Just like this: <%@ OutputCache Duration="1200" VaryByParam="none" %> However, as you can see, the control is recreated every 12 minutes, because it takes from 5 to 10 seconds to generate it. Now, t...

Asp.Net GetVaryByCustomString(...) in web farm scenario

We have a problem with output caching used within a web farm environment which cannot be replicated in a single node situation. An un-cached page has an un-cached parent user control which has child user controls which are cached. The time to cache is set by setting the PartialCachingAttribute on the user control's class declaration and ...

How can I ensure a dynamically-generated javascript file is never cached?

I have a dynamically-generated javascript file that I want to ensure is NEVER cached by the browser. My current method is to simply append a (new) guid to the url in the script tag on each page view. For example: <script type="text/javascript" src="/js/dynamic.js?rand=979F861A-C487-4AA8-8BD6-84E7988BD460"></script> My question is...i...

ASP.NET: Clear client output cache on log out

My web client requires client-side output caching since it makes use of its own Back and Forward buttons (which basically just call the browser back/forward buttons). The issue I'm having, however, is (of course) when the user signs out of the app. The client-side output cache remains so anyone can click the "back" button and it appears...

How do I turn off browser caching for my entire ASP.NET MVC site?

I'd like to disable browser caching for every page on my site. I know I can do it per action, but I'd like to know if there's a way to do it site-wide. ...