473,388 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Back button issue

Hi,
Every time I write ASP.NET application I have the same problem - Back button
on the browser is my enemy. I have to tell client avoid using "Back" button
and if you use it make sure to refresh the page to latest information.

I decided to pay information to application on the web and I see that some
sites don't have those issues. Like I used some forum site that uses PERL
(files with ext. pl) and Back button from browser gets new updated page
everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.
Nov 19 '05 #1
8 6114
Your page_load is rewriting the page each time you enter because you do not
have your code trap within the following:

If NOT IsPostBack then

End If

"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,
Every time I write ASP.NET application I have the same problem - Back
button on the browser is my enemy. I have to tell client avoid using
"Back" button and if you use it make sure to refresh the page to latest
information.

I decided to pay information to application on the web and I see that some
sites don't have those issues. Like I used some forum site that uses PERL
(files with ext. pl) and Back button from browser gets new updated page
everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.

Nov 19 '05 #2
Sorry.
But you totally misunderstood the problem. I always check IsPostBack. It is
not the point.
The problem is what happens when user clicks on the "Back" button on the
browser. What I usually get is the old cashed on the client page that needs
to be refreshed to get updated information. That is not what user expects -
they want to use "Back" button on the browser and still get page with
updated results. Till now I thought that it is impossible unless user plays
around with browser history setting.
But now I see sites that do update the content of the page even if I click
"Back" button.

My question if it possible in ASP.NET and how?
Thanks,
Shimon

"Mark Sandfox" <No****@NoSpam.com> wrote in message
news:Pq*****************@newssvr31.news.prodigy.co m...
Your page_load is rewriting the page each time you enter because you do
not have your code trap within the following:

If NOT IsPostBack then

End If

"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,
Every time I write ASP.NET application I have the same problem - Back
button on the browser is my enemy. I have to tell client avoid using
"Back" button and if you use it make sure to refresh the page to latest
information.

I decided to pay information to application on the web and I see that
some sites don't have those issues. Like I used some forum site that uses
PERL (files with ext. pl) and Back button from browser gets new updated
page everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.


Nov 19 '05 #3
I'm not sure how those other sites do it, but in .net you can use the
IsPostBack property to make your life a lot easier. In my current project
with JSP, we had to create an entire transaction framework to protect
us/data from the Back button too. After four months or so, I figured there
HAD to be a better way. There was, it's called .net! :> haha

Maybe the IsPostBack isn't going to solve your problem 100%, but I hope it's
a good start.
"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,
Every time I write ASP.NET application I have the same problem - Back
button on the browser is my enemy. I have to tell client avoid using
"Back" button and if you use it make sure to refresh the page to latest
information.

I decided to pay information to application on the web and I see that some
sites don't have those issues. Like I used some forum site that uses PERL
(files with ext. pl) and Back button from browser gets new updated page
everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.

Nov 19 '05 #4
I got second answer with IsPostBack... I know about it. It just solves the
issue that if you press a button on the form you don't want to do the same
actions that you do initial "arrival" to the page. It allows you to save
some calls to database and improve performance. In some cases you must use
it if you want to get new information from user.

Now ...
The problem is that if user clicks on the "Back" <-- button on the browser
then usually you get cash of the page that was saved by browser. (Am I wrong
about it? At least this is what I and my clients see). Really what I want to
get is updated version of the page.
Let say you have Product Information page that shows you basic information
about product. You have update functionality on a different page "Update
product information". Let say for sake of discussion after you update
product information you stay on the same page and don't redirect to Product
Information page. Now user wants to see product information page he /she
clicks on the "Back button on the browser (may be two times in my scenario)
and sees the page with old information (then client calls me and tells me
about a bug and I have to tell him/her to refresh the page. After few calls
the get the idea and I am off the hook.)

Can I do anything so the page will update after a user clicks on "Back"
button?
Again Thank you.
Shimon.
"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,
Every time I write ASP.NET application I have the same problem - Back
button on the browser is my enemy. I have to tell client avoid using
"Back" button and if you use it make sure to refresh the page to latest
information.

I decided to pay information to application on the web and I see that some
sites don't have those issues. Like I used some forum site that uses PERL
(files with ext. pl) and Back button from browser gets new updated page
everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.

Nov 19 '05 #5
Maybe you want to look at the response object and tell it not to cache the
page. Or, I think the Cach API also has a method that you can sent along with
the response object to not to cache the page. Also, if you want your page to
load new data each time the page is loaded, then you should not enclose your
code in the If Not IsPostBack.

"Shimon Sim" wrote:
Sorry.
But you totally misunderstood the problem. I always check IsPostBack. It is
not the point.
The problem is what happens when user clicks on the "Back" button on the
browser. What I usually get is the old cashed on the client page that needs
to be refreshed to get updated information. That is not what user expects -
they want to use "Back" button on the browser and still get page with
updated results. Till now I thought that it is impossible unless user plays
around with browser history setting.
But now I see sites that do update the content of the page even if I click
"Back" button.

My question if it possible in ASP.NET and how?
Thanks,
Shimon

"Mark Sandfox" <No****@NoSpam.com> wrote in message
news:Pq*****************@newssvr31.news.prodigy.co m...
Your page_load is rewriting the page each time you enter because you do
not have your code trap within the following:

If NOT IsPostBack then

End If

"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,
Every time I write ASP.NET application I have the same problem - Back
button on the browser is my enemy. I have to tell client avoid using
"Back" button and if you use it make sure to refresh the page to latest
information.

I decided to pay information to application on the web and I see that
some sites don't have those issues. Like I used some forum site that uses
PERL (files with ext. pl) and Back button from browser gets new updated
page everytime.
Can I do anything about this in ASP.NET?
Thanks,
Shimon.



Nov 19 '05 #6
> But you totally misunderstood the problem. I always check IsPostBack. It
is Yup, I misunderstood as well, sorry 'bout that.
browser. What I usually get is the old cashed on the client page that
needs

Can you play with the expiry date for the page? Someone else with more html
and aspx knowledge should be able to chime in here so I can learn about this
too. But it sounds like you don't necessarily want to chop their fingers
off for using the Back button, just protect yourself from displaying
cached/old data? Setting the page expiry to something like zero should
force IE to refresh the page when the user hits the back button. Or maybe
I'm totally wrong? Sorry if I am.
Nov 19 '05 #7
you can code the same in asp.net.

1) set the page to expire, so when back button is hit, it refreshed rather
than pulled from cache
2) break yourself from the asp.net postback model. once you do above, your
users will see the browser alert that data needs to be resent on a back to a
postback page. instead use real anchors (not link buttons) for navigation.
3) on pages that post, design so they can repost. for example with a cart,
ask for new the quanity instead of click to add one.

a little design work and the back button is your friend. its such a popular
feature, that windows apps are adding back button support.

-- bruce (sqlwork.com)

"Shimon Sim" <es*****@att.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
| Hi,
| Every time I write ASP.NET application I have the same problem - Back
button
| on the browser is my enemy. I have to tell client avoid using "Back"
button
| and if you use it make sure to refresh the page to latest information.
|
| I decided to pay information to application on the web and I see that some
| sites don't have those issues. Like I used some forum site that uses PERL
| (files with ext. pl) and Back button from browser gets new updated page
| everytime.
| Can I do anything about this in ASP.NET?
| Thanks,
| Shimon.
|
|
Nov 19 '05 #8
bruce barker wrote:
you can code the same in asp.net.

1) set the page to expire, so when back button is hit, it refreshed
rather than pulled from cache


That's a dangerous fallacy. The HTTP 1.1 spec specifies that history
mechanisms are not caches and thus don't need to honor Cache-Control or
Expires headers. Not even Cache-Control: no-store.

Atually, many browsers *don't* work like that, provided the protocol is
HTTP 1.1. Thus, the "avoid caching" trick works more often than not,
Opera being one noticeable exception (maybe it's just that I've never
found the magic combination of Cache-Control/Expires headers that makes
it do that).

But once you're down to HTTP 1.0 it gets really nasty...

Cheers,

--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #9

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

Similar topics

21
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" ...
0
by: jaydfischer | last post by:
Here is the code that I tried with no luck. Even though the cache is not saved, the page still appears but goes to the server to get the page instead of local cache. When it comes back to the...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
11
by: Sandy | last post by:
Hello - Thought I was almost done with my project and then a back arrow button issue raised its ugly head. Once a user fills out a form and submits it (done via stored procedure into a Sql...
5
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each...
1
by: mrboyer79 | last post by:
hello all, i'm having an issue where the back button i created (not the browser back) is causing me to lose data. allow me to explain: i have three pages. page one is a short form where the user...
7
by: nkodali | last post by:
Hi, I am having a signup.asp page where a user enters his details and clicks on subscribe button. I am doing server side validation to check if the user already exists in the database and then...
1
by: CoolRajan | last post by:
Hi friends, I have four form pages in my application and all the pages contain different fields for entering values in that. In my first page I have one Continue button and on submitting it...
1
by: Lavankumar | last post by:
Hi, My application runs fine in IE6 and firefox but when I tested in IE7 my back button on the browser leaves me at "Webpage expired" and I am using POST as I should not use GET but when I tried...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.