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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The OutputCacheAttribute class is part of the System.Web.MVC namespace. You can use VaryByParam with it:
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).