Asp.Net WriteSubsitution vs PartialView - the right way
Posted
by radu-negrila
on Stack Overflow
See other posts from Stack Overflow
or by radu-negrila
Published on 2009-11-24T13:01:45Z
Indexed on
2010/03/22
13:41 UTC
Read the original article
Hit count: 460
asp.net-mvc
|mvc
Hi,
I have a partial view that should not be cached in a output cached MVC view. Usually you write non-cached content by using Response.WriteSubstitution. The problem is that WriteSubstitution takes as a parameter a HttpResponseSubstitutionCallback callback which looks like this:
public delegate string HttpResponseSubstitutionCallback(System.Web.HttpContext context)
This is where things get complicated since there is no easy/fun way to generate the html on the fly. You have to do a hack like this.
So the question is: Is there an easier way to make a partial view not cached ?
© Stack Overflow or respective owner