473,385 Members | 1,782 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,385 software developers and data experts.

"Previous page" ?

TR
In an "Abandon Changes" button on my UserPreferences.aspx form, I'd like to
redirect back to the page the user was on before coming to the
UserPreferences form. It could be any one of my web app's pages with a link
to the UserPreferences page in its topmenu. (I'm testing for stale session
tokens and can prevent users from bookmarking the page.) However, in
codebehind for the AbandonChanges click event, the REFERRER is the
UserPreferences page itself, having posted to itself. Does asp.net keep
track of the "actual previous page" so to speak, when the previous page is
from the same web application? Or is that sort of state tracking up to the
developer?
Thanks
Nov 19 '05 #1
2 1933
Hi TR,

The problem you're dealing with is a facet of the WebForm object model. As a
WebForm posts back to itself, and the Referer is the last page visited, the
Referer is as likely to be the same page as it is to be another.

The solution is to keep track of the Referer (persist it in ViewState, most
likely) after the first time the page is visited. This can be done using a
conditional statement to check if the Referer's URL is the same as the
current page, and only saving it if it is not.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"TR" <TR@nowhere.biz> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
In an "Abandon Changes" button on my UserPreferences.aspx form, I'd like
to
redirect back to the page the user was on before coming to the
UserPreferences form. It could be any one of my web app's pages with a
link
to the UserPreferences page in its topmenu. (I'm testing for stale session
tokens and can prevent users from bookmarking the page.) However, in
codebehind for the AbandonChanges click event, the REFERRER is the
UserPreferences page itself, having posted to itself. Does asp.net keep
track of the "actual previous page" so to speak, when the previous page is
from the same web application? Or is that sort of state tracking up to the
developer?
Thanks

Nov 19 '05 #2
TR
Thanks for the helpful suggestion, Kevin.
TR

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:#m**************@TK2MSFTNGP14.phx.gbl...
Hi TR,

The problem you're dealing with is a facet of the WebForm object model. As a WebForm posts back to itself, and the Referer is the last page visited, the Referer is as likely to be the same page as it is to be another.

The solution is to keep track of the Referer (persist it in ViewState, most likely) after the first time the page is visited. This can be done using a
conditional statement to check if the Referer's URL is the same as the
current page, and only saving it if it is not.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"TR" <TR@nowhere.biz> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
In an "Abandon Changes" button on my UserPreferences.aspx form, I'd like
to
redirect back to the page the user was on before coming to the
UserPreferences form. It could be any one of my web app's pages with a
link
to the UserPreferences page in its topmenu. (I'm testing for stale session tokens and can prevent users from bookmarking the page.) However, in
codebehind for the AbandonChanges click event, the REFERRER is the
UserPreferences page itself, having posted to itself. Does asp.net keep
track of the "actual previous page" so to speak, when the previous page is from the same web application? Or is that sort of state tracking up to the developer?
Thanks


Nov 19 '05 #3

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

Similar topics

1
by: midiweb01 | last post by:
Sorry for my bad english here! I try my best. I would like to make a slideshow for my site about paintings. I have four menus: Portraits-landscapes-Still Life-Animals Each Menu has his own...
3
by: nan | last post by:
Hi All, I am trying to connect the Database which is installed in AS400 using DB2 Client Version 8 in Windows box. First i created the Catalog, then when i selected the connection type...
1
by: yasin | last post by:
is it possible that pressing "previous page"(back) button of web browser by code ?
1
by: Jeff | last post by:
I need to place a "Previous Page" link on every page within my site and a simple javascript:history.back() will not work because I need it to capture the state of the page when I left it. For...
3
by: karen987 | last post by:
Can someone please explain what code i need to add to keep a set of links at the bottom of a pop up window? I need it in a page where people post comments. It is a pop up window, of about 500x400...
2
by: Gozil | last post by:
Hello, im having a problem with the text input field im working with. I've made an ajax application that will suggest different links below the input field but if the user already searched something...
1
by: Tyecom | last post by:
I have a application that has more than 15 forms. On some of the forms, I need to give the user that ability to go to the "previous" page. Can someone help me with this? I'm using VB.Net 2005. ...
4
by: lander | last post by:
I've read the page life cycle thing in msdn, still, i'm getting a bit confused of thinking how all the things are going under the hood... I know that when page loading, that the controls'...
1
by: charliemears | last post by:
Hi there... How can I limit search results so that there is a "Next 10" and "Previous 10"? thanks for any reply....
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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,...
0
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...

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.