473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Clear Output cache..??

Hi
i have added a tag to the asp.net page .aspx
<%@ OutputCache Duration="600" VaryByParam="*" %>

it caches the whole page. But problem is that after logout its not getting cleared and if i tried to loggin with some other user it shows old data cached for previous user.

Please give me solution so that i can clear Output cache on user logout.
Jan 7 '09 #1
1 3562
r035198x
13,262 8TB
If the logout is destroying the session correctly, then you can tell ASP.NET to cache pages for the current session only.

First you need to add VaryByCustom=”SessionID” to the OutputCache directive. Then you simply override (in global.asax) GetVaryByCustomString to return that sessionID.
something like:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Public override string GetVaryByCustomString(HttpContext context, string arg) {       
  3.  
  4.    if(arg.ToLower() == “sessionid”) {
  5.        HttpCookie c = context.Request.Cookies[“ASP.NET_SessionID”];
  6.        if(c != null) return c.Value;
  7.    }
  8.    return base.GetVaryByCustomString(context, arg);
  9. }  
  10.  

P.S: I'm not a .NET programmer so you need to verify that my code is syntactically correct
Jan 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Romy Sreedharan | last post by:
Hello, I am wondering whether there is a mechanism to clear the Hard Disk Cache using C#? This is for O.S Windows XP regards romy
0
by: RMD | last post by:
Is there a way to programmatically clear the output cache of a usercontrol from the containing page (or anywhere else for that matter)? I basically want a button that, when clicked, will force...
0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
2
by: Welman Jordan | last post by:
Hello, I met with a tough problem when making my pages. Please help. To make the problem short, i write down what i want here first, and then explain my situation in details. How can I...
2
by: Les Caudle | last post by:
When displaying a database driven product page, I cache the page using: <%@ OutputCache Duration="86400" VaryByParam="ProductID" %> which works fine UNLESS I change the pricing or description...
3
by: Vish | last post by:
Is there a way to see the output cache entries in the httpcontext ? i tried looping thru the items in the cache but they dont seem to be there. I know there are several ways to remove them using...
3
by: Janning Vygen | last post by:
Hi, i am testing a few queries in my postgresql DB. The first query after reboot is always slower because of an empty OS page/file cache. I want to test my queries without any files in the...
0
by: SharpSmith | last post by:
hi i have a strange problem with OutPut cache working fine on development box and not working on production server background : @outputCahce directive is fine, but wanted to make centralized...
2
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.