How to prevent aspx page from being cached by user's browser?

Discussion in 'ASP .Net' started by feng, Feb 8, 2004.

  1. feng

    feng Guest

    In my ASP.Net app I have a aspx page that's called by an
    other page's client side JavaScript code. The problem is
    that the first time this page get loaded, it will be
    cached in the user's local cache and will not be refreshed
    in the following calls. I checked the following calls and
    I see that even the page's Page_Load method of the
    codebehind will not be invoked.

    I also checked that if I clear the browser's cache each
    time the page get called, then the following call will be
    refreshed.

    My question:
    1) I have many aspx pages, why only this page has this
    issue:
    2) What do I do to solve this problem?

    Here is the client side JavaScript that calls the this
    page, and the 'Open/QicWebError.aspx' is the aspx page I
    am talking about:

    <script language='javascript'>
    window.showModalDialog
    ('Open/QicWebError.aspx', '_blank', 'height=380,
    width=490', true);
    </script>
    feng, Feb 8, 2004
    #1
    1. Advertising

  2. If you don't specify HTTP expiration using Cache-Control headers or Expires
    headers, IE is free to "guess" your intentions.

    You can explicitly force your response not to get cached:

    See the

    Response.Cache.SetExpires
    Response.Cache.SetMaxAge
    and
    Response.Cache.SetRevalidation

    members for more info.

    --
    Thanks,

    Eric Lawrence
    Program Manager
    Assistance and Worldwide Services

    This posting is provided "AS IS" with no warranties, and confers no rights.


    "feng" <> wrote in message
    news:c75001c3ee0e$4e47b160$...
    > In my ASP.Net app I have a aspx page that's called by an
    > other page's client side JavaScript code. The problem is
    > that the first time this page get loaded, it will be
    > cached in the user's local cache and will not be refreshed
    > in the following calls. I checked the following calls and
    > I see that even the page's Page_Load method of the
    > codebehind will not be invoked.
    >
    > I also checked that if I clear the browser's cache each
    > time the page get called, then the following call will be
    > refreshed.
    >
    > My question:
    > 1) I have many aspx pages, why only this page has this
    > issue:
    > 2) What do I do to solve this problem?
    >
    > Here is the client side JavaScript that calls the this
    > page, and the 'Open/QicWebError.aspx' is the aspx page I
    > am talking about:
    >
    > <script language='javascript'>
    > window.showModalDialog
    > ('Open/QicWebError.aspx', '_blank', 'height=380,
    > width=490', true);
    > </script>
    >
    Eric Lawrence [MSFT], Feb 8, 2004
    #2
    1. Advertising

  3. Check out this faq,
    http://www.extremeexperts.com/Net/FAQ/DisablingBackButton.aspx

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "feng" <> wrote in message
    news:c75001c3ee0e$4e47b160$...
    > In my ASP.Net app I have a aspx page that's called by an
    > other page's client side JavaScript code. The problem is
    > that the first time this page get loaded, it will be
    > cached in the user's local cache and will not be refreshed
    > in the following calls. I checked the following calls and
    > I see that even the page's Page_Load method of the
    > codebehind will not be invoked.
    >
    > I also checked that if I clear the browser's cache each
    > time the page get called, then the following call will be
    > refreshed.
    >
    > My question:
    > 1) I have many aspx pages, why only this page has this
    > issue:
    > 2) What do I do to solve this problem?
    >
    > Here is the client side JavaScript that calls the this
    > page, and the 'Open/QicWebError.aspx' is the aspx page I
    > am talking about:
    >
    > <script language='javascript'>
    > window.showModalDialog
    > ('Open/QicWebError.aspx', '_blank', 'height=380,
    > width=490', true);
    > </script>
    >
    Saravana [MVP], Feb 8, 2004
    #3
  4. feng

    Teemu Keiski Guest

    Hi,

    you can also try putting

    <%@ Outputcache Location="None"%>

    directive at top of your page's aspx (just after Page directive)

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "feng" <> wrote in message
    news:c75001c3ee0e$4e47b160$...
    In my ASP.Net app I have a aspx page that's called by an
    other page's client side JavaScript code. The problem is
    that the first time this page get loaded, it will be
    cached in the user's local cache and will not be refreshed
    in the following calls. I checked the following calls and
    I see that even the page's Page_Load method of the
    codebehind will not be invoked.

    I also checked that if I clear the browser's cache each
    time the page get called, then the following call will be
    refreshed.

    My question:
    1) I have many aspx pages, why only this page has this
    issue:
    2) What do I do to solve this problem?

    Here is the client side JavaScript that calls the this
    page, and the 'Open/QicWebError.aspx' is the aspx page I
    am talking about:

    <script language='javascript'>
    window.showModalDialog
    ('Open/QicWebError.aspx', '_blank', 'height=380,
    width=490', true);
    </script>
    Teemu Keiski, Feb 8, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Um9i?=
    Replies:
    3
    Views:
    14,510
    Steven Cheng[MSFT]
    Jan 21, 2004
  2. Itai
    Replies:
    0
    Views:
    537
  3. Craig G
    Replies:
    0
    Views:
    379
    Craig G
    Mar 7, 2005
  4. Replies:
    0
    Views:
    451
  5. Chris  Ashley
    Replies:
    1
    Views:
    334
    Patrice
    Dec 11, 2006
Loading...

Share This Page