Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > "Back" button and ViewState

Reply
Thread Tools

"Back" button and ViewState

 
 
=?Utf-8?B?RGlmZmlkZW50?=
Guest
Posts: n/a
 
      03-06-2006
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!
 
Reply With Quote
 
 
 
 
Naveen K Kohli
Guest
Posts: n/a
 
      03-06-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGlmZmlkZW50?=
Guest
Posts: n/a
 
      03-06-2006
Hello Naveen,

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

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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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!

>
>
>

 
Reply With Quote
 
Joerg Jooss
Guest
Posts: n/a
 
      03-07-2006
Thus wrote Diffident,

> Hello Naveen,
>
> When I tried adding the following line of code:
> Response.Cache.SetCacheability(HttpCacheability.No Cache);
> 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
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
=?Utf-8?B?RGlmZmlkZW50?=
Guest
Posts: n/a
 
      03-07-2006

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.No Cache);
> > 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
> (E-Mail Removed)
>
>
>

 
Reply With Quote
 
Joerg Jooss
Guest
Posts: n/a
 
      03-07-2006
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
(E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ViewState: "function 'ViewState.get_Item' evaluated and returned null" Steph ASP .Net 2 05-11-2011 02:35 PM
Errors: Failed to load viewstate. & Validation of viewstate MAC failed. sck10 ASP .Net 6 09-01-2006 05:59 PM
Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help... ujjc001 ASP .Net 0 07-27-2005 01:52 PM
Viewstate errors... how do I get viewstate working? mark ASP .Net Building Controls 0 02-20-2004 02:17 PM
Corrupted ViewState (Yes, another issue concerning viewstate) Ben Rush ASP .Net 2 12-05-2003 04:17 PM



Advertisments