Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
0 Points
5 Posts
Aug 10, 2010 03:24 AM|LINK
Hello.
I am using asp.net mvc 2 and IIS 7.5
I have problems with caching results of controllers methods which return partial view. Web server doesn't cache this results.
<%Html.RenderAction("TownsList", "Towns"); %>
..........
[OutputCache(Duration = 10000, VaryByParam = "None")] public ViewResult TownsList() { var towns = adsRepository.Towns.OrderByDescending(x => x.Ads.Count()).Take(6).OrderBy(x => x.Name); return View(towns.ToList()); }
I check cache state using the following line of code: <%= DateTime.Now.ToLongTimeString() %>
Please, help me to solve this problem.
Maximka1
0 Points
5 Posts
cache and RenderAction
Aug 10, 2010 03:24 AM|LINK
Hello.
I am using asp.net mvc 2 and IIS 7.5
I have problems with caching results of controllers methods which return partial view. Web server doesn't cache this results.
<%Html.RenderAction("TownsList", "Towns"); %>
..........
[OutputCache(Duration = 10000, VaryByParam = "None")]
public ViewResult TownsList()
{
var towns = adsRepository.Towns.OrderByDescending(x => x.Ads.Count()).Take(6).OrderBy(x => x.Name);
return View(towns.ToList());
}
I check cache state using the following line of code: <%= DateTime.Now.ToLongTimeString() %>
Please, help me to solve this problem.