|
-
Mar 23rd, 2007, 12:13 AM
#1
Thread Starter
Frenzied Member
Clear History or Cache (Other post advice dont work)
Why I need to do this:
I got a main page with controls to switch the language (image buttons) and an iFrame where the "body" pages go. When the user switch language, I reload the page, and also the current "body" page.
But if the user click back, it seems it only apply to the main page, not the "body" page and the main page go back to the last language, but not the body page.
So what I want to do is clear the "history" or "cache" if possible. It seems it is, but the advice I found on other post (mostly by M), does not work: Not
Code:
System.Web.HttpResponse.RemoveOutputCacheItem("/")
; or
Code:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
This code worked on a sample application I wrote, but for some reason not in my "real" website. I loved the "Paged Expired" if u stupid enough to click "back" (Got a " System.Web.HttpException: Response is not available in this context" error..maybe because placed inside an event handler in a form?)
Code:
Response.Expires = 0;
Response.ExpiresAbsolute = DateTime.Now;
Response.CacheControl = "no-cache";
You can repliate the problem by following any of the two links to my site in my signature.
Last edited by StrangerInBeijing; Mar 27th, 2007 at 09:41 AM.
Reason: Resolved
-
Mar 23rd, 2007, 10:41 PM
#2
Fanatic Member
Re: Clear History or Cache (Other post advice dont work)
het in the page load of your previous screen use this:
Response.Cache.SetCacheability(HttpCacheability.NoCache)
-
Mar 24th, 2007, 04:25 AM
#3
Thread Starter
Frenzied Member
Re: Clear History or Cache (Other post advice dont work)
Like I said, that seems to have no effect.
-
Mar 25th, 2007, 06:13 AM
#4
Thread Starter
Frenzied Member
Re: Clear History or Cache (Other post advice dont work)
does it *have* to be in the page load?
I dont want this to happen each time a page load, but only when the language was changed.
Even so...that line does nothing!
-
Mar 25th, 2007, 06:54 AM
#5
Re: Clear History or Cache (Other post advice dont work)
Ah, the joys of using frames.
Whenever the language is changed, store it in a session variable.
Make sure the page in the IFRAME is always loaded from server, not from cache.
In the page load, have it check the session variable for the current language and set the culture appropriately.
Not much else you can do, you are using an IFRAME.
-
Mar 25th, 2007, 05:30 PM
#6
Thread Starter
Frenzied Member
Re: Clear History or Cache (Other post advice dont work)
Yep, the stuff is *EVIL* (but then, I wrote this site learning, and really no time to do it over now....kicking myself!)
Make sure the page in the IFRAME is always loaded from server, not from cache.
Do you mind explaining this?
Thanks
-
Mar 27th, 2007, 05:00 AM
#7
Re: Clear History or Cache (Other post advice dont work)
This bit:
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Should be set for all your pages that appear inside the IFRAME so that it is always loaded from the server. In these IFRAME pages, always do a check for the language in the session variable. You then proceed from there.
-
Mar 27th, 2007, 08:44 AM
#8
Thread Starter
Frenzied Member
Re: Clear History or Cache (Other post advice dont work)
Yep, it's ok now. I did this for all the iframe pages, but still had a problem. Then realized the main form actually only reload when the language change, so put that code in the main form too, and now it's fine.
The "child" pages checked a session variable before, so nothing else had to be done.
Thanks a lot for the help, and tell the kids iFrames (and .net) are EVIL!
-
Mar 27th, 2007, 01:53 PM
#9
Re: Clear History or Cache (Other post advice dont work)
I will circumvent that problem by not having any children at all.
-
Mar 27th, 2007, 07:34 PM
#10
Thread Starter
Frenzied Member
Re: Clear History or Cache (Other post advice dont work)
 Originally Posted by mendhak
I will circumvent that problem by not having any children at all. 
too late for me...first on her way!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|