Hi, I read at Scottgu blog about using OutputCache for a function but this didn't worked for me. How can I use [OutputCache(Duration=60)] for a function and can I add VaryByParam in this statement? Which namespace is required?
+1
A:
The OutputCacheAttribute class is part of the System.Web.MVC namespace. You can use VaryByParam with it:
<OutputCache(Duration:=60, VaryByParam:="Any")> _
Function Index() As ActionResult
ViewData("Message") = "Welcome to ASP.NET MVC!"
Return View()
End Function
but I would guess that you can only apply it to MVC methods that return an ActionResult - I don't think you could use it in a WebForms project (which I'm guessing from your question is what you're using).
PhilPursglove
2010-04-17 07:31:15
@PhilPursglove 80% you're right. But this would be a very useful property for .net :(
HasanGursoy
2010-04-17 07:47:05