Why all the pages when I press back button ?

Discussion in 'ASP .Net' started by Bazza Formez, Dec 5, 2004.

  1. Bazza Formez

    Bazza Formez Guest

    Hi there,
    I am *very* new to this... so please excuse poor terminology etc.

    I am building a small content management system.. and have just managed to
    get an asp.net page up & running that edits / deleted data presented via a
    datagrid via a datareader. All is well, the database is updated correctly..

    However after merrily doing a few update cylces, I noticed afterwards that
    when I pressed the back button on the browser, I was presented with a
    "historical" page for each post cycle. Is there a way to stop this ? I don't
    want to see any "history" in this way ...

    Is this normal, or is there a setting to prevent this happening ?

    Thanks,

    Bazza
    Bazza Formez, Dec 5, 2004
    #1
    1. Advertising

  2. There are several ways a page can be cached, and so there are several ways
    you can specify for a page to not be cached.
    This code has worked well for me:

    Response.Expires = 0
    Response.Cache.SetNoStore()
    Response.AppendHeader("Pragma", "no-cache")

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "Bazza Formez" <> wrote in message
    news:aFysd.13725$...
    > Hi there,
    > I am *very* new to this... so please excuse poor terminology etc.
    >
    > I am building a small content management system.. and have just managed to
    > get an asp.net page up & running that edits / deleted data presented via a
    > datagrid via a datareader. All is well, the database is updated
    > correctly..
    >
    > However after merrily doing a few update cylces, I noticed afterwards that
    > when I pressed the back button on the browser, I was presented with a
    > "historical" page for each post cycle. Is there a way to stop this ? I
    > don't want to see any "history" in this way ...
    >
    > Is this normal, or is there a setting to prevent this happening ?
    >
    > Thanks,
    >
    > Bazza
    >
    >
    >
    Steve C. Orr [MVP, MCSD], Dec 5, 2004
    #2
    1. Advertising

  3. Bazza Formez

    Dave Fancher Guest

    This is unfortunately one of the side-effects of using server-side
    processing in a stateless environment. Nearly every action requires a
    round-trip to the server. There's nothing you can really do about it short
    of moving all of your logic to the client side and doing a batch update.

    Here's the (short and extremely simplified) explanation of why this happens:
    1.) User accesses page (page request, 1st history item added)
    2.) User clicks "edit" for one of the items in the grid. The form submits
    (another page request) so the page can be rerendered using text boxes,
    etc... (2nd history item added)
    3.) User makes changes and clicks "save." The form submits (another page
    request) so the database can be updated and the grid redrawn with the
    changes. (3rd history item added)
    4.) User clicks "delete." The form is submitted (yet another page request)
    so the item can be deleted from the database and the grid can be redrawn
    with the changes
    5.) ... you probably get the picture by now.

    As you can see, each of these actions result in a page request, which causes
    the browser to add an item to the history list.

    --
    Dave Fancher
    http://davefancher.blogspot.com


    "Bazza Formez" <> wrote in message
    news:aFysd.13725$...
    > Hi there,
    > I am *very* new to this... so please excuse poor terminology etc.
    >
    > I am building a small content management system.. and have just managed to
    > get an asp.net page up & running that edits / deleted data presented via a
    > datagrid via a datareader. All is well, the database is updated
    > correctly..
    >
    > However after merrily doing a few update cylces, I noticed afterwards that
    > when I pressed the back button on the browser, I was presented with a
    > "historical" page for each post cycle. Is there a way to stop this ? I
    > don't want to see any "history" in this way ...
    >
    > Is this normal, or is there a setting to prevent this happening ?
    >
    > Thanks,
    >
    > Bazza
    >
    >
    >
    Dave Fancher, Dec 5, 2004
    #3
  4. Bazza Formez

    Dave Fancher Guest

    ....short of caching that is! Thanks Steve

    I guess it's too late and I should be going to bed...

    --
    Dave Fancher
    http://davefancher.blogspot.com


    "Dave Fancher" <> wrote in message
    news:...
    > This is unfortunately one of the side-effects of using server-side
    > processing in a stateless environment. Nearly every action requires a
    > round-trip to the server. There's nothing you can really do about it
    > short of moving all of your logic to the client side and doing a batch
    > update.
    >
    > Here's the (short and extremely simplified) explanation of why this
    > happens:
    > 1.) User accesses page (page request, 1st history item added)
    > 2.) User clicks "edit" for one of the items in the grid. The form submits
    > (another page request) so the page can be rerendered using text boxes,
    > etc... (2nd history item added)
    > 3.) User makes changes and clicks "save." The form submits (another page
    > request) so the database can be updated and the grid redrawn with the
    > changes. (3rd history item added)
    > 4.) User clicks "delete." The form is submitted (yet another page
    > request) so the item can be deleted from the database and the grid can be
    > redrawn with the changes
    > 5.) ... you probably get the picture by now.
    >
    > As you can see, each of these actions result in a page request, which
    > causes the browser to add an item to the history list.
    >
    > --
    > Dave Fancher
    > http://davefancher.blogspot.com
    >
    >
    > "Bazza Formez" <> wrote in message
    > news:aFysd.13725$...
    >> Hi there,
    >> I am *very* new to this... so please excuse poor terminology etc.
    >>
    >> I am building a small content management system.. and have just managed
    >> to get an asp.net page up & running that edits / deleted data presented
    >> via a datagrid via a datareader. All is well, the database is updated
    >> correctly..
    >>
    >> However after merrily doing a few update cylces, I noticed afterwards
    >> that when I pressed the back button on the browser, I was presented with
    >> a "historical" page for each post cycle. Is there a way to stop this ? I
    >> don't want to see any "history" in this way ...
    >>
    >> Is this normal, or is there a setting to prevent this happening ?
    >>
    >> Thanks,
    >>
    >> Bazza
    >>
    >>
    >>

    >
    >
    Dave Fancher, Dec 5, 2004
    #4
  5. Bazza Formez

    Bazza Formez Guest

    Thanks for that Dave.



    "Dave Fancher" <> wrote in message
    news:...
    > ...short of caching that is! Thanks Steve
    >
    > I guess it's too late and I should be going to bed...
    >
    > --
    > Dave Fancher
    > http://davefancher.blogspot.com
    >
    >
    > "Dave Fancher" <> wrote in message
    > news:...
    >> This is unfortunately one of the side-effects of using server-side
    >> processing in a stateless environment. Nearly every action requires a
    >> round-trip to the server. There's nothing you can really do about it
    >> short of moving all of your logic to the client side and doing a batch
    >> update.
    >>
    >> Here's the (short and extremely simplified) explanation of why this
    >> happens:
    >> 1.) User accesses page (page request, 1st history item added)
    >> 2.) User clicks "edit" for one of the items in the grid. The form
    >> submits (another page request) so the page can be rerendered using text
    >> boxes, etc... (2nd history item added)
    >> 3.) User makes changes and clicks "save." The form submits (another page
    >> request) so the database can be updated and the grid redrawn with the
    >> changes. (3rd history item added)
    >> 4.) User clicks "delete." The form is submitted (yet another page
    >> request) so the item can be deleted from the database and the grid can be
    >> redrawn with the changes
    >> 5.) ... you probably get the picture by now.
    >>
    >> As you can see, each of these actions result in a page request, which
    >> causes the browser to add an item to the history list.
    >>
    >> --
    >> Dave Fancher
    >> http://davefancher.blogspot.com
    >>
    >>
    >> "Bazza Formez" <> wrote in message
    >> news:aFysd.13725$...
    >>> Hi there,
    >>> I am *very* new to this... so please excuse poor terminology etc.
    >>>
    >>> I am building a small content management system.. and have just managed
    >>> to get an asp.net page up & running that edits / deleted data presented
    >>> via a datagrid via a datareader. All is well, the database is updated
    >>> correctly..
    >>>
    >>> However after merrily doing a few update cylces, I noticed afterwards
    >>> that when I pressed the back button on the browser, I was presented with
    >>> a "historical" page for each post cycle. Is there a way to stop this ? I
    >>> don't want to see any "history" in this way ...
    >>>
    >>> Is this normal, or is there a setting to prevent this happening ?
    >>>
    >>> Thanks,
    >>>
    >>> Bazza
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
    Bazza Formez, Dec 5, 2004
    #5
  6. Bazza Formez

    Bazza Formez Guest

    Thanks Steve.. I will try those settings.


    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:%23Uoya$...
    > There are several ways a page can be cached, and so there are several ways
    > you can specify for a page to not be cached.
    > This code has worked well for me:
    >
    > Response.Expires = 0
    > Response.Cache.SetNoStore()
    > Response.AppendHeader("Pragma", "no-cache")
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://Steve.Orr.net
    >
    >
    > "Bazza Formez" <> wrote in message
    > news:aFysd.13725$...
    >> Hi there,
    >> I am *very* new to this... so please excuse poor terminology etc.
    >>
    >> I am building a small content management system.. and have just managed
    >> to get an asp.net page up & running that edits / deleted data presented
    >> via a datagrid via a datareader. All is well, the database is updated
    >> correctly..
    >>
    >> However after merrily doing a few update cylces, I noticed afterwards
    >> that when I pressed the back button on the browser, I was presented with
    >> a "historical" page for each post cycle. Is there a way to stop this ? I
    >> don't want to see any "history" in this way ...
    >>
    >> Is this normal, or is there a setting to prevent this happening ?
    >>
    >> Thanks,
    >>
    >> Bazza
    >>
    >>
    >>

    >
    >
    Bazza Formez, Dec 5, 2004
    #6
    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. Loke Kit Kai
    Replies:
    2
    Views:
    7,630
    Saravana [MVP]
    Dec 1, 2003
  2. Preethi
    Replies:
    1
    Views:
    387
    Spam Catcher
    Dec 22, 2005
  3. vishal
    Replies:
    2
    Views:
    1,103
  4. Replies:
    2
    Views:
    472
    Neredbojias
    Jul 23, 2005
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,748
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page