473,513 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Back" button and ViewState

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!
Mar 6 '06 #1
5 3652
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" <Di*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
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!

Mar 6 '06 #2
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" <Di*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
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!


Mar 6 '06 #3
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
ne********@joergjooss.de
Mar 7 '06 #4

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
ne********@joergjooss.de

Mar 7 '06 #5
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
ne********@joergjooss.de
Mar 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2261
by: Nick Li | last post by:
Hi, I need to create a html page so that "Back" button(or some other button) is disabled in IE browser. I would appreciate your help. Nick Li
1
5798
by: JJA | last post by:
When my webserver does not process a user's change because of an invalid password, I inform the user and I want to present them a button for a retry: <TR id=continuebuttonrow> <td...
1
2062
by: Tom Youngquist | last post by:
Does anyone know the command to "imitate" the "Back" button on a browser in .NET. I have looked in the Redirect but can't seem to find anything. I can re-direct to a specific page but my users...
5
2406
by: Dani | last post by:
Hello everybody, I have some code that disables form elements on body load, but I notice when I hit the "back" button, I need to re-enable the form elements (that is done by clicking on a radial...
12
10146
by: VB Programmer | last post by:
I know some sites will display the following message if you click on the BACK button in your browser. How do I implement this feature? Warning: Page has Expired The page you requested was...
2
3787
by: Leszek Taratuta | last post by:
Hello, I am using the following code to prevent users to see the previous pages: Response.CacheControl = "no-cache"; Response.AddHeader( "Pragma", "no-cache" ); Response.Expires = -1; When...
11
2671
by: John A Grandy | last post by:
asp.net 1.1 ie 6 how to lock-out the user from clicking the browser "Back" button ?
8
23217
by: Coleen | last post by:
Yes, I know why would I want to create a back button when there is one on the browser? Because that's what the users want! they want a "Previous" button that they can click from any web page in...
0
3513
by: sagarp86 | last post by:
How to lock / deactivate "Refresh" and "Back" button on browser. Problem is in voting application. Once we click for a vote application goes to next page and increament one vote in the database....
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.