Request.IsAuthenticated problem with Cache in ASP.NET
Posted
by Julien
on Stack Overflow
See other posts from Stack Overflow
or by Julien
Published on 2010-03-26T20:26:25Z
Indexed on
2010/03/26
20:33 UTC
Read the original article
Hit count: 602
Hello guys or girls..!
I'm new in ASP.NET and I have a problem...
When I want to cache I View or an Action like this :
<%@ Page title="" language="C#" masterpagefile="~/Views/Shared/MemberHome.Master" inherits="System.Web.Mvc.ViewPage<IndexViewData>" %>
<%@ OutputCache duration="400" varybyparam="divId;regionId;page" %>
I know that it cache all data in my page ... But in my page I have a condition like this :
<% if(Request.IsAuthenticated) { %>
<a href="/fr/Advertiser/Search"><img src="/content/images/v_2/bot.jpg" alt="Entreprises liées à vos passions" title="Entreprises liées à vos passions" /></a>
<% } else { %>
<a href="/fr/Advertiser/OpenSearch"><img src="/content/images/v_2/bot.jpg" alt="Entreprises liées à vos passions" title="Entreprises liées à vos passions" /></a>
<% } %>
I dont want to cache this variable : Request.IsAuthenticated ... because some result depend of this condition ... I try the donut caching by scottgu's but it return (I think) just some text not a bool ... http://weblogs.asp.net/scottgu/archive/2006/11/28/tip-trick-implement-donut-caching-with-the-asp-net-2-0-output-cache-substitution-feature.aspx
Now I'm tired to try anything that come to my mind .. can you help me pleaseee! :)
Julien.
© Stack Overflow or respective owner