asp.net-caching

how to cache css, images and js?

感情迁移 提交于 2019-12-17 21:53:45
问题 I would like to have images, css, and javascript cached client-side on their browser when they load up a web page. There are so many different types of caching I am confused as to which ones to use with asp.net mvc. Would it also be possible to have their browsers check for new or modified versions of these files? Thanks! 回答1: Browsers take care of this for you automatically, actually. You have to go out of your way to get them to NOT cache css, js, html and images. I'm not that familiar with

Authorization and ASP.NET MVC Caching

六月ゝ 毕业季﹏ 提交于 2019-12-17 18:47:45
问题 I'm confused on ASP.NET MVC caching and authorization and in dire need of some clarification. My self-made authorization attribute inherits from AuthorizeAttribute . Its overridden AuthorizeCore method runs every time, even if I set an [OutputCache] attribute on a controller action. I understand that part. Now the mind bender for me: AuthorizeCore will fail every time now when I actually do output caching and the page is served from the cache. The reason is that when the request is cached,

Authorization and ASP.NET MVC Caching

旧街凉风 提交于 2019-12-17 18:47:28
问题 I'm confused on ASP.NET MVC caching and authorization and in dire need of some clarification. My self-made authorization attribute inherits from AuthorizeAttribute . Its overridden AuthorizeCore method runs every time, even if I set an [OutputCache] attribute on a controller action. I understand that part. Now the mind bender for me: AuthorizeCore will fail every time now when I actually do output caching and the page is served from the cache. The reason is that when the request is cached,

different versions of output caching based on selected values of several dropdownlists

末鹿安然 提交于 2019-12-11 19:07:02
问题 So this is about output caching, and I am trying to use <%@ OutputCache VaryByParam="">, how to realize this? 回答1: VaryByParam refers to the query string parameters in the request url. So you would need to submit the dropdownlist values as part of the url query string. You would probably need to use javascript to alter the request url since you would not know the selected values server side. 来源: https://stackoverflow.com/questions/8041819/different-versions-of-output-caching-based-on-selected

OutputCache varying by a complex object property

时光总嘲笑我的痴心妄想 提交于 2019-12-07 01:09:12
问题 I have a controller action that receives a complex object as a parameter, I need the OutputCache to vary by one of the properties of this complex object. Is this possible? How? 回答1: if you have a model like public class person{ public string Name {get;set;} public string location {get;set;} } and in the (strongly typed)view you have a form @model Person @Html.BeginForm(){ @Html.TextBoxFor(x=>x.Name) @Html.TextBoxFor(x=>x.location) } and you submit the form to an ActionResult savePerson, with

OutputCache varying by a complex object property

我的未来我决定 提交于 2019-12-05 05:33:28
I have a controller action that receives a complex object as a parameter, I need the OutputCache to vary by one of the properties of this complex object. Is this possible? How? if you have a model like public class person{ public string Name {get;set;} public string location {get;set;} } and in the (strongly typed)view you have a form @model Person @Html.BeginForm(){ @Html.TextBoxFor(x=>x.Name) @Html.TextBoxFor(x=>x.location) } and you submit the form to an ActionResult savePerson, with varying signature like public ActionResult savePerson(Person p){ // p.Name // p.location } or public

how to cache css, images and js?

天大地大妈咪最大 提交于 2019-11-28 17:03:47
I would like to have images, css, and javascript cached client-side on their browser when they load up a web page. There are so many different types of caching I am confused as to which ones to use with asp.net mvc. Would it also be possible to have their browsers check for new or modified versions of these files? Thanks! Browsers take care of this for you automatically, actually. You have to go out of your way to get them to NOT cache css, js, html and images. I'm not that familiar with ASP MVC, but I think they type of caching you're thinking of is opcode caching for your created dynamic

Authorization and ASP.NET MVC Caching

╄→гoц情女王★ 提交于 2019-11-28 08:46:12
I'm confused on ASP.NET MVC caching and authorization and in dire need of some clarification. My self-made authorization attribute inherits from AuthorizeAttribute . Its overridden AuthorizeCore method runs every time, even if I set an [OutputCache] attribute on a controller action. I understand that part. Now the mind bender for me: AuthorizeCore will fail every time now when I actually do output caching and the page is served from the cache. The reason is that when the request is cached, the httpContext.Session supplied with AuthorizeCore is null !? Here's some simplified code: protected