问题
http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx
To the sake of simplicity, please try out this. Basically, I am trying to do the mobile view engine, but then i found out that I have outputcache, which will cache one of 2 view (PC view) and then when i tried to access through mobile, it automatic show PC view.
So is there anyway to avoid this problem while still keeping the outputcache?
Thanks
回答1:
Is your problem that out of the box variance from Outputcache (varibyparam, varybycostum, varybyquerystring) is not enough?
If you need a cache that has variance by some route value then this might help you.
http://blog.stevensanderson.com/2008/10/15/partial-output-caching-in-aspnet-mvc/
or this: http://blog.maartenballiauw.be/post/2008/06/Creating-an-ASPNET-MVC-OutputCache-ActionFilterAttribute.aspx
I havn't tried these solutions but maybe they get you started.
EDIT At the time I wrote this answer I thought that Outputcache has no varinace by route values. But it realy has. Each URL has its own cache entry.
来源:https://stackoverflow.com/questions/2209526/output-cache-problem-on-viewengine-that-use-2-separate-view-for-1-controller