Page_Load Not Firing On Subsequent Views of the Page

Discussion in 'ASP .Net' started by Guadala Harry, Sep 10, 2004.

  1. Just wondering what could cause this: I have observed that when first
    opening an aspx page, the Page_Load event fires as expected. Then I go to
    other pages in the site. When returning to any page that has been previously
    viewed, the Page_Load event does not fire (or at least the Page_Load event
    procedure is not executed). FWIW: PostBacks are working fine (meaning that
    the Page_Load event procedure executes on PostBacks). The problem is just
    when I navigate away to another page and then return to a previously viewed
    page.

    Please note that I do NOT have output Caching enabled on any of the pages.
    Also, while I have not tested every single page in my ASP.NET Web
    application, I have observed this behavior in many of them (and none I have
    tested show the behavior I expect/need - which is to have Page_Load fire on
    every request for the page).

    What can cause this? How can I make it so that the Page_Load event procedure
    executes on every request for the page?

    Thanks!
    Guadala Harry, Sep 10, 2004
    #1
    1. Advertising

  2. Guadala Harry

    bruce barker Guest

    the browser is caching the page itself, thus the server knows nothing about
    it.

    -- bruce (sqlwork.com)



    "Guadala Harry" <> wrote in message
    news:OPDf$...
    > Just wondering what could cause this: I have observed that when first
    > opening an aspx page, the Page_Load event fires as expected. Then I go to
    > other pages in the site. When returning to any page that has been

    previously
    > viewed, the Page_Load event does not fire (or at least the Page_Load event
    > procedure is not executed). FWIW: PostBacks are working fine (meaning that
    > the Page_Load event procedure executes on PostBacks). The problem is just
    > when I navigate away to another page and then return to a previously

    viewed
    > page.
    >
    > Please note that I do NOT have output Caching enabled on any of the pages.
    > Also, while I have not tested every single page in my ASP.NET Web
    > application, I have observed this behavior in many of them (and none I

    have
    > tested show the behavior I expect/need - which is to have Page_Load fire

    on
    > every request for the page).
    >
    > What can cause this? How can I make it so that the Page_Load event

    procedure
    > executes on every request for the page?
    >
    > Thanks!
    >
    >
    bruce barker, Sep 11, 2004
    #2
    1. Advertising

  3. Is there any way I can tell the browser to NOT cache the page? Or is doing
    that generally frowned upon?

    -G


    "bruce barker" <> wrote in message
    news:...
    > the browser is caching the page itself, thus the server knows nothing

    about
    > it.
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "Guadala Harry" <> wrote in message
    > news:OPDf$...
    > > Just wondering what could cause this: I have observed that when first
    > > opening an aspx page, the Page_Load event fires as expected. Then I go

    to
    > > other pages in the site. When returning to any page that has been

    > previously
    > > viewed, the Page_Load event does not fire (or at least the Page_Load

    event
    > > procedure is not executed). FWIW: PostBacks are working fine (meaning

    that
    > > the Page_Load event procedure executes on PostBacks). The problem is

    just
    > > when I navigate away to another page and then return to a previously

    > viewed
    > > page.
    > >
    > > Please note that I do NOT have output Caching enabled on any of the

    pages.
    > > Also, while I have not tested every single page in my ASP.NET Web
    > > application, I have observed this behavior in many of them (and none I

    > have
    > > tested show the behavior I expect/need - which is to have Page_Load fire

    > on
    > > every request for the page).
    > >
    > > What can cause this? How can I make it so that the Page_Load event

    > procedure
    > > executes on every request for the page?
    > >
    > > Thanks!
    > >
    > >

    >
    >
    Guadala Harry, Sep 11, 2004
    #3
  4. You can do that by passing some of the header arguments..
    http://www.htmlgoodies.com/beyond/nocache.html for ASP/HTML answers.

    Or you can use Response.Cache object and call SetNoStore..



    "Guadala Harry" <> wrote in message
    news:...
    > Is there any way I can tell the browser to NOT cache the page? Or is doing
    > that generally frowned upon?
    >
    > -G
    >
    >
    > "bruce barker" <> wrote in message
    > news:...
    > > the browser is caching the page itself, thus the server knows nothing

    > about
    > > it.
    > >
    > > -- bruce (sqlwork.com)
    > >
    > >
    > >
    > > "Guadala Harry" <> wrote in message
    > > news:OPDf$...
    > > > Just wondering what could cause this: I have observed that when first
    > > > opening an aspx page, the Page_Load event fires as expected. Then I go

    > to
    > > > other pages in the site. When returning to any page that has been

    > > previously
    > > > viewed, the Page_Load event does not fire (or at least the Page_Load

    > event
    > > > procedure is not executed). FWIW: PostBacks are working fine (meaning

    > that
    > > > the Page_Load event procedure executes on PostBacks). The problem is

    > just
    > > > when I navigate away to another page and then return to a previously

    > > viewed
    > > > page.
    > > >
    > > > Please note that I do NOT have output Caching enabled on any of the

    > pages.
    > > > Also, while I have not tested every single page in my ASP.NET Web
    > > > application, I have observed this behavior in many of them (and none I

    > > have
    > > > tested show the behavior I expect/need - which is to have Page_Load

    fire
    > > on
    > > > every request for the page).
    > > >
    > > > What can cause this? How can I make it so that the Page_Load event

    > > procedure
    > > > executes on every request for the page?
    > > >
    > > > Thanks!
    > > >
    > > >

    > >
    > >

    >
    >
    Girish bharadwaj, Sep 11, 2004
    #4
  5. Guadala Harry

    Teemu Keiski Guest

    Or add:

    <%@ OutputCache Location="none" %>

    directive at top of the page

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke


    "Guadala Harry" <> wrote in message
    news:...
    > Is there any way I can tell the browser to NOT cache the page? Or is doing
    > that generally frowned upon?
    >
    > -G
    >
    >
    > "bruce barker" <> wrote in message
    > news:...
    > > the browser is caching the page itself, thus the server knows nothing

    > about
    > > it.
    > >
    > > -- bruce (sqlwork.com)
    > >
    > >
    > >
    > > "Guadala Harry" <> wrote in message
    > > news:OPDf$...
    > > > Just wondering what could cause this: I have observed that when first
    > > > opening an aspx page, the Page_Load event fires as expected. Then I go

    > to
    > > > other pages in the site. When returning to any page that has been

    > > previously
    > > > viewed, the Page_Load event does not fire (or at least the Page_Load

    > event
    > > > procedure is not executed). FWIW: PostBacks are working fine (meaning

    > that
    > > > the Page_Load event procedure executes on PostBacks). The problem is

    > just
    > > > when I navigate away to another page and then return to a previously

    > > viewed
    > > > page.
    > > >
    > > > Please note that I do NOT have output Caching enabled on any of the

    > pages.
    > > > Also, while I have not tested every single page in my ASP.NET Web
    > > > application, I have observed this behavior in many of them (and none I

    > > have
    > > > tested show the behavior I expect/need - which is to have Page_Load

    fire
    > > on
    > > > every request for the page).
    > > >
    > > > What can cause this? How can I make it so that the Page_Load event

    > > procedure
    > > > executes on every request for the page?
    > > >
    > > > Thanks!
    > > >
    > > >

    > >
    > >

    >
    >
    Teemu Keiski, Sep 11, 2004
    #5
    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. Brad

    Page_Load not firing

    Brad, Aug 20, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    959
  2. C K
    Replies:
    2
    Views:
    3,718
  3. DazedAndConfused

    Canceling Subsequent events from page_load

    DazedAndConfused, Sep 22, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    523
    DazedAndConfused
    Sep 23, 2005
  4. Jason Wilson
    Replies:
    0
    Views:
    509
    Jason Wilson
    Sep 19, 2006
  5. Jules Flynn
    Replies:
    1
    Views:
    143
    Thomas 'PointedEars' Lahn
    May 3, 2004
Loading...

Share This Page