How to make per- http Request cache in ASP.NET 3.5

家住魔仙堡 提交于 2019-12-04 23:52:31

We have used HttpContext.Current.Items collection to do RequestScope caching. It works well.

just to clarify what ggonsalv was referring to

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.items.aspx

HttpContext.Items["key"] = value;

UPDATE: the mvc specific version

http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.httpcontext(v=VS.100).aspx

How about using the Context collection. This allows data to be shared between all your controls but only lasts for the request.

Use it like this context.Items("base_url") = "default.aspx"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!