Professional Web Applications Themes

How to use Response.Redirct like a browser back button? - ASP.NET General

What is the difference between the two? I have a page "one" with a button using Response.Redirect("pagetwo.asxp") to go to the next page. On page two I have a button using Response.Redirect("pageone.aspx") to go back to page one. When I view page one, select some information, then go to page two, and then select the back button (using the response.redirect) none of my selections remain. If I just use the back button of the web browser everything works fine. Anything I am doing wrong? Thanks....

  1. #1

    Default How to use Response.Redirct like a browser back button?

    What is the difference between the two?

    I have a page "one" with a button using Response.Redirect("pagetwo.asxp") to
    go to the next page.

    On page two I have a button using Response.Redirect("pageone.aspx") to go
    back to page one.

    When I view page one, select some information, then go to page two, and then
    select the back button (using the response.redirect) none of my selections
    remain. If I just use the back button of the web browser everything works
    fine.

    Anything I am doing wrong?

    Thanks.


    Michelle Guest

  2. #2

    Default Re: How to use Response.Redirct like a browser back button?

    Kevin is right.
    To get it to work like the back button, Instead of using Response.Redirect
    to go back to page one you could execute some client side javascript like
    this:
    history.go(-1);

    So you could have a "Back" anchor tag in your HTML that looks like this:
    <a href='javascript:history.go(-1);'>Back</a>

    Here's more info:
    http://www.devguru.com/Technologies/ecmascript/quickref/history_go.html

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "Michelle A." <com> wrote in message
    news:phx.gbl... 
    to 
    then 


    Steve Guest

  3. #3

    Default Re: How to use Response.Redirct like a browser back button?

    One caution about using JavaScript history, though: With ASP.Net it can have
    unexpected results, as ASP.Net WebForms submit to themselves, and have
    different ViewState data in them at different times.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    The more I learn, the less I know.

    "Steve C. Orr, MCSD" <net> wrote in message
    news:phx.gbl... [/ref]
    Response.Redirect("pagetwo.asxp") [/ref]
    go 
    > then [/ref]
    selections [/ref]
    works 
    >
    >[/ref]


    Kevin Guest

  4. #4

    Default Re: How to use Response.Redirct like a browser back button?

    Cool..

    I will take a look at that on Monday..

    Thanks.


    "Steve C. Orr, MCSD" <net> wrote in message
    news:phx.gbl... [/ref]
    Response.Redirect("pagetwo.asxp") [/ref]
    go 
    > then [/ref]
    selections [/ref]
    works 
    >
    >[/ref]


    Michelle Guest

Similar Threads

  1. Disable back button in browser and X in top right
    By nrutter in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: May 20th, 06:15 PM
  2. Browser Back Button
    By bryancounts in forum Dreamweaver AppDev
    Replies: 5
    Last Post: July 31st, 08:57 AM
  3. Browser back button and Flash
    By JFalk1 in forum Macromedia Flash Sitedesign
    Replies: 3
    Last Post: September 24th, 09:13 AM
  4. Browser-History-Back Button
    By Steve in forum ASP.NET General
    Replies: 4
    Last Post: August 16th, 10:13 PM
  5. Back button on the browser problem
    By shimonsim@talamus.com in forum ASP.NET General
    Replies: 3
    Last Post: June 29th, 12:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139