Results 1 to 10 of 10

Thread: Clear History or Cache (Other post advice dont work)

  1. #1

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Resolved 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
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  2. #2
    Fanatic Member karthikeyan's Avatar
    Join Date
    Oct 2005
    Location
    inside .net
    Posts
    919

    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)
    Loving dotnet

  3. #3

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Clear History or Cache (Other post advice dont work)

    Like I said, that seems to have no effect.
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  4. #4

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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!
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  6. #6

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  8. #8

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    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!
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Clear History or Cache (Other post advice dont work)

    I will circumvent that problem by not having any children at all.

  10. #10

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Clear History or Cache (Other post advice dont work)

    Quote Originally Posted by mendhak
    I will circumvent that problem by not having any children at all.
    too late for me...first on her way!
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width