Results 1 to 9 of 9

Thread: How do you all deal with the BACK button

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    How do you all deal with the BACK button

    The browser back button is not working well with our web page - and a control we purchased for doing uploads (which uses ajax and silverlight).

    How do you all deal with this? We want to not allow the BACK button...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you all deal with the BACK button

    The short answer is you don't.

    The long answer is that you should never have to ask the question "How do I disable the back button?" because simply, you can't. Instead, you work your application around the problem you have. The most common reason to want this is data being resubmitted and code being re-executed.

    So obviously, different ways to deal with it.

    1) Disable caching on the vulnerable page so that it's always reloaded from server.
    2) If it's a data resubmission problem, introduce an intermediary page which then again does a redirect to the target page. So, example
    upload.aspx -> pleasewait.aspx -> complete.aspx

    Pressing back on complete.aspx will only take them to pleasewait which pushes them again to complete.aspx.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How do you all deal with the BACK button

    Hey,

    Silverlight navigation has got known issues with the back button. Simply put, it doesn't work out of the box.

    Telerik have implemented one solution, but that would require a license with them.

    Gary

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: How do you all deal with the BACK button

    I am going to tell the client this.

    We had a web consultant coding this page for 3 weeks and he did some research into why BACK was causing issues. Apparently you can use the SCRIPT MANAGER to handle saving session state for hitting the back button (we stay on the same page and each post back changes session variables controlling the STAGE of entry the user has reached).

    We are using a ajax/silverlight upload control. Seems the silverlight part of the upload is what allows you to upload multiple files on the same "file dialog" popup.

    And seems silverlight and the script manager don't work well with BACK.

    Seems there is some other script history downloads he found - but his last way was yesterday. He's on a permanent job assignment starting Monday...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you all deal with the BACK button

    The intermediate page would make sense then. I think it'd be easier than having to hack the existing JS?

  6. #6
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: How do you all deal with the BACK button

    If you have a session that indicates what step the user is on can't this be used to test if the user repeated the step (clicked back) and therefore reset the page for the step required? Is it a known bug your dealing with as Gary aluded to?

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: How do you all deal with the BACK button

    What I usually do is Response.Redirect("samepage.aspx") as the last line of executing code to clear the headers. But unfortunately this requires an extra round-trip to the server.

    e.g. if button is clicked, then I do:
    Code:
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' do whatever processing you need to do. like insert record into database etc.
    
        ' then finally redirect to same page.
        Response.Redirect(Me.AppRelativeVirtualPath)
    End Sub
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  8. #8

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: How do you all deal with the BACK button

    Quote Originally Posted by Pradeep1210 View Post
    What I usually do is Response.Redirect("samepage.aspx") as the last line of executing code to clear the headers.
    Could you please explain this a bit more?

    Also - doesn't the PAGE_LOAD event fire anyway - so you basically get it right now and after the REDIRECT.

    How do you tell the difference in the PAGE_LOAD which way you came in??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: How do you all deal with the BACK button

    Quote Originally Posted by szlamany View Post
    Could you please explain this a bit more?

    Also - doesn't the PAGE_LOAD event fire anyway - so you basically get it right now and after the REDIRECT.

    How do you tell the difference in the PAGE_LOAD which way you came in??
    Yes that's what I meant by an extra roundtrip to server. The page is loaded twice. First time the actual postback from client. Second time the call from Response.Redirect. Second time it will process it like a fresh (new) page request. i.e. first time IsPostback is true, second time it would be false.

    Response.Redirect causes the browser to request the same page. But is it a fresh request. So if you press Back, Forward or Refresh, it won't cause it to popup that ugly dialog from the browser asking you to submit the data again.
    So I also find this technique good when you don't want client to be able to submit same data again (after cliking refresh button etc.)
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

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