outputcache

IIS7.5 max-age issue(asp.net mvc output cache)

我是研究僧i 提交于 2019-12-04 06:43:12
We use Windows server 2008 R2 Enterprise And IIS7.5.7600.16385, and i deployed a simple web (asp.net mvc, c#, .net framework 4.5.1) on the server. a controller like below, and *.cshtml only output a datetime: public class DetailController : Controller { [OutputCache(Duration = 300, VaryByParam = "id")] public ActionResult Index(int id) { return View(); } } when i first request the url http://localhost:80/Detail/Index?id=3 , the response is correct: Cache-Control:public, max-age=300 Date:Mon, 24 Oct 2016 12:11:59 GMT Expires:Mon, 24 Oct 2016 12:16:51 GMT Last-Modified:Mon, 24 Oct 2016 12:11:51

Output Cache problem on ViewEngine that use 2 separate view for 1 controller

喜欢而已 提交于 2019-12-04 05:42:24
问题 http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx To the sake of simplicity, please try out this. Basically, I am trying to do the mobile view engine, but then i found out that I have outputcache, which will cache one of 2 view (PC view) and then when i tried to access through mobile, it automatic show PC view. So is there anyway to avoid this problem while still keeping the outputcache? Thanks 回答1: Is your problem that out of the box variance

Configure the MVC.NET OutputCache to return 304 Not Modified if an ActionResult hasn't changed

牧云@^-^@ 提交于 2019-12-04 05:09:19
Introduce the Problem We have successfully configured the browser cache to return a saved response if the server indicates 304 Not Modified . Here is the config: <caching> <outputCacheSettings> <outputCacheProfiles> <add name="TransparentClient" location="Client" duration="0" /> </outputCacheProfiles> </outputCacheSettings> </caching> The web.config is perfect and sets Cache-control:private, max-age=0 so that: The browser will cache responses, will always validate the cache, and will return the cached response if the server responds 304. The problem is that our MVC.NET Actions always respond

ASP.NET (MVC) Outputcache and concurrent requests

最后都变了- 提交于 2019-12-04 02:45:15
Let's say that, theoratically, I have a page / controller action in my website that does some very heavy stuff. It takes about 10 seconds to complete it's operation. Now, I use .NET's outputcache mechanism to cache it for 15 minutes (for examle, I use [OutputCache(Duration = 900)] ) What happens if, after 15 minutes, the cache is expired and 100 users request the page again within those 10 seconds that it takes to do the heavy processing? The heavy stuff is done only the first time, and there is some locking mechanism so that the other 99 users will get the cache result The heavy stuff is done

ASP.NET OutPutCache VaryByParam and VaryByHeader with AJAX

馋奶兔 提交于 2019-12-04 01:20:28
I'm trying to do some caching using VaryByParam AND VaryByHeader. When an AJAX request comes in I return a partial XHTML. When a regular request comes in I send the partial XHTML page with header / footer. I tried to cache the page by doing: [OutputCache( Duration = 5, VaryByParam = "nickname,page", VaryByHeader = "X-Requested-With" )] However this doesn't work... if I do a regular request first then run the AJAX call I get the full cached page instead of the partial and vice-versa. Seems like VaryByHeader is being ignored. Is it because X-Requested-With is omitted on normal requests? Or

Outputcache doesn't work with routing

冷暖自知 提交于 2019-12-03 21:44:37
I'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario we can cache complete pages. When I tried to enable output caching I noticed that no caching was done. It seems that the outputcache page directive is completely ignored. Is this true or am I missing something? Can this be fixed? I made a small test app (I uploaded

ASP.NET MVC OutputCache doesn't work for root URI

和自甴很熟 提交于 2019-12-03 16:59:23
问题 I'm learning ASP.NET MVC and bugged by one issue. In the HomeController, the Index action has OutputCache attribute, but it seems doesn't work. [HandleError] public class HomeController : Controller { [OutputCache(Duration=5, VaryByParam="none")] public ActionResult Index() { ViewData["Title"] = "Home Page" + DateTime.Now; ViewData["Message"] = "Welcome to ASP.NET MVC! " + DateTime.Now; return View(); } } After quite a few minutes trying, I found that it is due to the way I access the action.

How do I configure ASP.Net OutputCache to vary by http vs https?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 10:45:27
Here is the scenario, a user opens up non-secure page from our WebApp, let's call it PageA, in their browser and then clicks a link in there that takes them to a secure instance of PageB. Once in PageB the user can subsequently click a link that takes them back to a secure instance of PageA (which they already viewed and is in OutputCache). I observed that even though PageA is being accessed over a different URL after visiting PageB (the secure one) it's actually pulling the prior cached copy rather making a fresh one. I verified this behavior in a debugging session, and was surprised that ASP

Setting optimum http caching headers and server params in ASP.Net MVC and IIS 7.5

我怕爱的太早我们不能终老 提交于 2019-12-03 08:43:41
问题 I have an ASP.Net site (happens to be MVC, but that's not relevant here) with a few pages I'd like cached really well. Specifically I'd like to achieve: output cached on the server for 2 hours. if the file content on the server changes, that output cache should be flushed for that page cached in the browser for 10 minutes (i.e. don't even ask the server if it's that fresh) when the browser does make an actual subsequent request, I'd like it to use etags, so that the server can return a 304 if

ASPX That Returns An Image - Output Cache-able?

和自甴很熟 提交于 2019-12-03 07:36:45
Greetings! I've created an APSX web form that returns a remote image based on some supplied parameters. It can be used like this: <img src="/ImageGetter.aspx?param1=abc&param2=123" /> ImageGetter.aspx's markup and code look similar to this: <%@ OutputCache Duration="100000" VaryByParam="*" Location="ServerAndClient" %> <%@ Page Language="C#" AutoEventWireup="false" EnableSessionState="False" CodeBehind="ImageGetter.aspx.cs" Inherits="ACME.Helpers.ImageGetter" %> This code is called in ImageGetter.aspx's Page_Load method: byte[] data = null; Dictionary<string, string> file_locations =