while the method we use in Substitution control should return strings, so how is it possible to use a donut caching in web forms on a server control which should be rendered server side?
for example Loginview control?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
I'm fairly certain you can't do this - the Substitution control will only allow you to insert a string into an outputcached page.
This makes sense if you think about the whole output of a server control, which could be a
<table>
that'll disrupt all your carefully crafted markup and/or something that requires a load of<script>
injected into the page - whereas injecting a single string is something that's relatively straightforward.UPDATE This is now a fully working example. There a few things happening here:
Here's the markup:
Here's the callback
Here's the helper class to render the user control
See these related questions:
One thing Micah's answer left out is that the substitution function must be
static
, accept aHttpContext
parameter, and return astring
. See this msdn page for more info.I've also extended Micah's helper class to be a little more flexible.
Markup
Implemenation
Class
Thanks again to Micah for the code