Force aspx page to load from server--not cache

Discussion in 'ASP .Net' started by William LaMartin, Jun 21, 2008.

  1. I have an aspx page, A.aspx, that uses some xml. The source of the xml is
    another aspx page, B.aspx. B.aspx is populated with xml by code that
    depends on several Session variables.

    This all works fine the first time you load A.aspx. however, on subsequent
    times--with changed session variables--A.aspx is the same, as is B.aspx, if
    you check it. However, B.aspx is not really the same, since if you refresh
    the browser, B.aspx will then display the new xml as it should for the new
    session variables.

    How can I force the B.aspx page to not be produced from cache when it is
    requested by A.aspx? There is no HTML on it so I cannot use something like
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">.
     
    William LaMartin, Jun 21, 2008
    #1
    1. Advertisements

  2. I found the solution: Put the following vb code in the load event for the
    aspx page in question (B.aspx)

    Response.Cache.SetCacheability(HttpCacheability.NoCache


    "William LaMartin" <> wrote in message
    news:...
    >I have an aspx page, A.aspx, that uses some xml. The source of the xml is
    >another aspx page, B.aspx. B.aspx is populated with xml by code that
    >depends on several Session variables.
    >
    > This all works fine the first time you load A.aspx. however, on
    > subsequent times--with changed session variables--A.aspx is the same, as
    > is B.aspx, if you check it. However, B.aspx is not really the same, since
    > if you refresh the browser, B.aspx will then display the new xml as it
    > should for the new session variables.
    >
    > How can I force the B.aspx page to not be produced from cache when it is
    > requested by A.aspx? There is no HTML on it so I cannot use something
    > like <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">.
    >
     
    William LaMartin, Jun 21, 2008
    #2
    1. Advertisements

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. Earl Teigrob
    Replies:
    6
    Views:
    8,148
    wadewalker25
    Sep 28, 2007
  2. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,428
    venky
    Jul 11, 2005
  3. =?Utf-8?B?b25l?=
    Replies:
    1
    Views:
    5,500
    Karl Seguin [MVP]
    Mar 8, 2006
  4. tshad

    no-cache to force reload new page

    tshad, Jul 27, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,002
    tshad
    Jul 27, 2006
  5. John
    Replies:
    2
    Views:
    1,399
  6. quoclinh
    Replies:
    3
    Views:
    924
    quoclinh
    Mar 12, 2007
  7. Replies:
    3
    Views:
    1,060
    Guillermo
    Apr 26, 2007
  8. Matcon
    Replies:
    3
    Views:
    22,085
    Matcon
    May 28, 2008
Loading...