outputcache

Disable client side caching

我是研究僧i 提交于 2019-12-20 12:06:26
问题 I've been searching for info on how to disable client side caching on project level . I know I can add the following before an action method: [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] I also read something about making profiles for caching, but that would also mean refering to them in several places. I would like a single setting in web.config, or maybe in IIS? The project I'm working on contains a lot of partial views Thank you in advance for any advice in

Using ASP.NET MVC OutputCache while varying View content based on whether user is authenticated

我们两清 提交于 2019-12-19 07:48:20
问题 I'm building an ASP.NET MVC 2 site where I'm using the OutputCache parameter heavily. However, I have a concern: using such caching may interfere with authentication . On all of my pages, I display whether the user is logged in or not. Furthermore, in some of my Views, I do filtering based on user role to determine whether or not to display some page content (for example, the Edit link on one of my pages is only shown to users in the roles of Moderator or Administrator). Will using

Using ASP.NET MVC OutputCache while varying View content based on whether user is authenticated

纵饮孤独 提交于 2019-12-19 07:48:18
问题 I'm building an ASP.NET MVC 2 site where I'm using the OutputCache parameter heavily. However, I have a concern: using such caching may interfere with authentication . On all of my pages, I display whether the user is logged in or not. Furthermore, in some of my Views, I do filtering based on user role to determine whether or not to display some page content (for example, the Edit link on one of my pages is only shown to users in the roles of Moderator or Administrator). Will using

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

独自空忆成欢 提交于 2019-12-18 13:25:51
问题 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

Disable caching on a partial view in MVC 3

北城余情 提交于 2019-12-18 03:04:42
问题 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")

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

白昼怎懂夜的黑 提交于 2019-12-18 02:51:33
问题 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? 回答1: 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

Clearing Page Cache in ASP.NET

守給你的承諾、 提交于 2019-12-17 02:42:30
问题 For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine... <%@OutputCache Duration="600" VaryByParam="*" %> However, if someone posts a comment, I want to clear the cache so that the page is refreshed and the comment can be seen. How do I do this in ASP.Net C#? 回答1: I've found the answer I was looking for: HttpResponse.RemoveOutputCacheItem("/caching/CacheForever.aspx"); 回答2: The above are fine if you know what pages

OutputCache on server

有些话、适合烂在心里 提交于 2019-12-13 17:16:00
问题 I define OutputCache attributes on top of my controller actions, so that the server can give the same response quickly to different users. Bu it caches the whole page. I mean the master page is also cached if I have cached an action that returns a View() . So the user account information on top of the master page gets shared by every user. I want to cache only the content page, not the master page, _Layout.cshtml. How can I exclude that? Edit: The part where I'm having trouble is this: @if

Caching Vary BY Param when we have ASP.NET Routing Values instead of QueryString values

人盡茶涼 提交于 2019-12-12 18:33:43
问题 Normally we can do caching and make dependency on Request.QueryString values like <%@ OutputCache Duration="15" VaryByParam="search" %> The url for such may be like: http://www.demo.com/default.aspx?search=name But in my application i am using ASP.NET 4.0 routing where i am passing the id of a product like: http://www.demo.com/searchdetails/40563 or http://www.demo.com/searchdetails/40564 and so on..... In this case i access the product id something as Page.Route.Value["product_id"] In this

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

梦想的初衷 提交于 2019-12-12 08:53:23
问题 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,