Im developing an asp.net mvc 3 site that serves multiple domains. So based on the domains I show different content.
For example if its www.domain1.com, in homepage I show 3 images and some text. If its www.domain2.com in homepage I show only text.
I implemented a custom output cache provider called FileOutputCache, which saves the cached pages into files, and I would like to us it in this project. But I have a BIG problem, I dont have access to the request, nor to the host...
This is one of the operations: public override object Add(string key, object entry, DateTime utcExpiry);
You can see that I have no access to the host, and the key doesnt depend on it... So if I deploy the site and the first user enters to www.domain1.com, it will render and cache the page with 3 images and text.... and if another user enters to www.domain2.com, it will show the 3 images and text :(
Does anyone know how can I differentiate the request's host in my custom output cache provider?
Thanks in advance! Juan
I solved this by using VaryByHeader = Host
As the domain is in the host, which is a header, you can just use that built-in asp.net
mvc functionality and it works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With