Results 1 to 3 of 3

Thread: Back Button Help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    Cape Cod, US
    Posts
    292

    Back Button Help

    Isn't there a way to keep a page out of the browser's history,
    so that it doesn't get reloaded when the user uses the Back button?

    I've got a page with a DataGrid making use of Edit/Update/Cancel
    so the page keeps being reloaded.
    It would be nice for the user to not have to backtrack through all that.

  2. #2
    Lively Member
    Join Date
    Oct 2001
    Location
    MA, US
    Posts
    78
    hi,

    what I did to avoid this situation:
    you must know the layout and the flow of your site.
    I added those 2 blocks at the beginning of each page
    in the second block the value of PageCurrentID is unique for each page and bust increase as the user go from page to page (you can increase with 100, to leave room for future pages)
    the first block may do the work, but does not work for all browsers, but the second take care off all
    on some places, if the user need to go to a previous page, you may need to alter manually the Session("PageCurrentID") to a lower value

    <%
    Response.Expires = -1000 'Make browser not cache pg.
    Response.ExpiresAbsolute = Now()-1
    Response.CacheControl="no-cache"
    %>
    <%
    dim PageCurrentID
    PageCurrentID = 6700 ' protection to not allow the user to use the Back button
    if (Session("PageCurrentID") >= PageCurrentID) then
    Response.Redirect "rejected.asp"
    else
    Session("PageCurrentID") = PageCurrentID
    end if
    %>

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    Cape Cod, US
    Posts
    292
    Thanks svatasoiu for your fast reply. I'll definitely consider your approach.

    I've also come across the Page.SmartNavigation property that seems to apply to my particular situation of all the page reloads.

    However, the documentation for SmartNavigation is a little scary and I'll have to test it thoroughly...

    Here's a snippet:

    Smart navigation is best used with ASP.NET pages that require frequent postbacks but with visual content that does not change dramatically on return. Consider this carefully when deciding whether to set this property to true.

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