I did a GetVaryByCustomString that returns:
context.User.Identity.IsAuthenticated.ToString();
But I have a big problem, imagine this flow:
The user(or anyone) access the home page. GetVaryByCustomString will return "false" and cache that. Every time that somebody ask if home page changed, will return 304.
I login at site and go to Home Page, GetVaryByCustomString returns "true" then cache isn´t used. Every time that I go to Home Page, ASP.NET returns me 304.
I logout, and go to Home Page, now GetVaryByCustomString returns 304, because of step one, but the OutputCache don´t know that the cache that I have, is from logged user.
If I press Ctrl+F5, it works, since that the problem is in browser/server, the server side cache is OK. But it return 304, and I have a logged page cached.
There is any solution? Or do I need to stop caching authenticated users?
UPDATE: I think that cache for mutable values just doesn´t work. It need that browsers do they cache by this values too....And don´t exists Vary by Cookies...