"Back" button and ViewState

Discussion in 'ASP .Net' started by =?Utf-8?B?RGlmZmlkZW50?=, Mar 6, 2006.

  1. Hello All,

    Most of you might be familiar with this problem i.e, viewstate is lost
    whenever we navigate from the one page to another. Does anyone have a remedy
    for this problem?

    On Page A, I have a datalist which has a "select" link for each row(I have
    1000's of such rows). When a user clicks a particular select link, I am
    redirecting him to Page B(this redirection is being done in
    Datalist_ItemCommand). Once on Page B, when user clicks "Back" button in the
    browser and clicks on another "Select" link, the datalist_ItemCommand is not
    being fired. He is forced to click the "Select" link twice.

    Does anyone for any alternatives for this problem?

    Thanks!
    =?Utf-8?B?RGlmZmlkZW50?=, Mar 6, 2006
    #1
    1. Advertising

  2. When user clicks on "Back" button, the page is being served from the
    browser's cache. The server does not get a chance to participate. You can
    disable page caching on client by adding the required pragma settings in
    headers. This should help.


    "Diffident" <> wrote in message
    news:...
    > Hello All,
    >
    > Most of you might be familiar with this problem i.e, viewstate is lost
    > whenever we navigate from the one page to another. Does anyone have a
    > remedy
    > for this problem?
    >
    > On Page A, I have a datalist which has a "select" link for each row(I have
    > 1000's of such rows). When a user clicks a particular select link, I am
    > redirecting him to Page B(this redirection is being done in
    > Datalist_ItemCommand). Once on Page B, when user clicks "Back" button in
    > the
    > browser and clicks on another "Select" link, the datalist_ItemCommand is
    > not
    > being fired. He is forced to click the "Select" link twice.
    >
    > Does anyone for any alternatives for this problem?
    >
    > Thanks!
    Naveen K Kohli, Mar 6, 2006
    #2
    1. Advertising

  3. Hello Naveen,

    When I tried adding the following line of code:
    Response.Cache.SetCacheability(HttpCacheability.NoCache);

    to prevent the browser from caching the page. When I did this, I got this
    error message in IE:

    -----
    Warning: Page has Expired The page you requested was created using
    information you submitted in a form. This page is no longer available. As a
    security precaution, Internet Explorer does not automatically resubmit your
    information for you.

    To resubmit your information and view this Web page, click the Refresh
    button.
    ------

    In Firefox, I am getting a "page cannot be displayed" error.

    Any pointers?

    Thank you.

    "Naveen K Kohli" wrote:

    > When user clicks on "Back" button, the page is being served from the
    > browser's cache. The server does not get a chance to participate. You can
    > disable page caching on client by adding the required pragma settings in
    > headers. This should help.
    >
    >
    > "Diffident" <> wrote in message
    > news:...
    > > Hello All,
    > >
    > > Most of you might be familiar with this problem i.e, viewstate is lost
    > > whenever we navigate from the one page to another. Does anyone have a
    > > remedy
    > > for this problem?
    > >
    > > On Page A, I have a datalist which has a "select" link for each row(I have
    > > 1000's of such rows). When a user clicks a particular select link, I am
    > > redirecting him to Page B(this redirection is being done in
    > > Datalist_ItemCommand). Once on Page B, when user clicks "Back" button in
    > > the
    > > browser and clicks on another "Select" link, the datalist_ItemCommand is
    > > not
    > > being fired. He is forced to click the "Select" link twice.
    > >
    > > Does anyone for any alternatives for this problem?
    > >
    > > Thanks!

    >
    >
    >
    =?Utf-8?B?RGlmZmlkZW50?=, Mar 6, 2006
    #3
  4. =?Utf-8?B?RGlmZmlkZW50?=

    Joerg Jooss Guest

    Thus wrote Diffident,

    > Hello Naveen,
    >
    > When I tried adding the following line of code:
    > Response.Cache.SetCacheability(HttpCacheability.NoCache);
    > to prevent the browser from caching the page. When I did this, I got
    > this error message in IE:
    >
    > -----
    > Warning: Page has Expired The page you requested was created using
    > information you submitted in a form. This page is no longer available.
    > As a
    > security precaution, Internet Explorer does not automatically resubmit
    > your
    > information for you.
    > To resubmit your information and view this Web page, click the Refresh
    > button. ------
    >
    > In Firefox, I am getting a "page cannot be displayed" error.


    That's not an error. It's just a warning that going "back" means resending
    previously submitted data again, which might be harmful if your web application
    doesn't deal with such a case.

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Mar 7, 2006
    #4
  5. Joerg,

    Do you know how I can disable this warning in IE?

    Thanks!

    "Joerg Jooss" wrote:

    > Thus wrote Diffident,
    >
    > > Hello Naveen,
    > >
    > > When I tried adding the following line of code:
    > > Response.Cache.SetCacheability(HttpCacheability.NoCache);
    > > to prevent the browser from caching the page. When I did this, I got
    > > this error message in IE:
    > >
    > > -----
    > > Warning: Page has Expired The page you requested was created using
    > > information you submitted in a form. This page is no longer available.
    > > As a
    > > security precaution, Internet Explorer does not automatically resubmit
    > > your
    > > information for you.
    > > To resubmit your information and view this Web page, click the Refresh
    > > button. ------
    > >
    > > In Firefox, I am getting a "page cannot be displayed" error.

    >
    > That's not an error. It's just a warning that going "back" means resending
    > previously submitted data again, which might be harmful if your web application
    > doesn't deal with such a case.
    >
    > Cheers,
    > --
    > Joerg Jooss
    >
    >
    >
    >
    =?Utf-8?B?RGlmZmlkZW50?=, Mar 7, 2006
    #5
  6. =?Utf-8?B?RGlmZmlkZW50?=

    Joerg Jooss Guest

    Thus wrote Diffident,

    > Joerg,
    >
    > Do you know how I can disable this warning in IE?


    You cannot disable that warning. Instead, think about a server-side solution
    to avoid that warning, like using Redirect-After-Post.

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Mar 7, 2006
    #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. John Hamm
    Replies:
    1
    Views:
    448
  2. sylvia sil
    Replies:
    1
    Views:
    600
    Curt_C [MVP]
    Dec 29, 2004
  3. =?Utf-8?B?RGlmZmlkZW50?=

    Viewstate and browser's back button

    =?Utf-8?B?RGlmZmlkZW50?=, Mar 7, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    424
    =?Utf-8?B?RGlmZmlkZW50?=
    Mar 7, 2006
  4. Author
    Replies:
    6
    Views:
    3,071
    George
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    332
    Useful Info
    Jun 3, 2007
Loading...

Share This Page