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

State management

Hi,

I have a web form which displays some information based on criteria I store
in the session. When the user interacts with the page it is changed and
session changed accordingly. The use can navigate from the page ok, if they
click back all is ok because the session still relates to the page. However
there may be a situation when the user navigates to a new version of the page
(type in the url etc). How I have a page in the browser history to which the
user can use the back button to navigate to, to which the current values in
the session have no relation.

Here's what I want to do, if the user presses back, detect the page does not
match the session and update the page with the current session values. But
the page load event is not fired, so how do I trigger my update code.

--
Tim Marsden
Nov 19 '05 #1
7 1541
you would need to track the page and some other request specific information
and add it to session to be able to determine where the user is from history

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Tim Marsden" <TM***@newsgroup.nospam> wrote in message
news:28**********************************@microsof t.com...
Hi,

I have a web form which displays some information based on criteria I
store
in the session. When the user interacts with the page it is changed and
session changed accordingly. The use can navigate from the page ok, if
they
click back all is ok because the session still relates to the page.
However
there may be a situation when the user navigates to a new version of the
page
(type in the url etc). How I have a page in the browser history to which
the
user can use the back button to navigate to, to which the current values
in
the session have no relation.

Here's what I want to do, if the user presses back, detect the page does
not
match the session and update the page with the current session values. But
the page load event is not fired, so how do I trigger my update code.

--
Tim Marsden

Nov 19 '05 #2
you would need to track the page and some other request specific information
and add it to session to be able to determine where the user is from history

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Tim Marsden" <TM***@newsgroup.nospam> wrote in message
news:28**********************************@microsof t.com...
Hi,

I have a web form which displays some information based on criteria I
store
in the session. When the user interacts with the page it is changed and
session changed accordingly. The use can navigate from the page ok, if
they
click back all is ok because the session still relates to the page.
However
there may be a situation when the user navigates to a new version of the
page
(type in the url etc). How I have a page in the browser history to which
the
user can use the back button to navigate to, to which the current values
in
the session have no relation.

Here's what I want to do, if the user presses back, detect the page does
not
match the session and update the page with the current session values. But
the page load event is not fired, so how do I trigger my update code.

--
Tim Marsden

Nov 19 '05 #3
Hi,
Thanks for the reply, but I don't understand how to do this. Can you
elaborate.
Tim

"Alvin Bruney [ASP.NET MVP]" wrote:
you would need to track the page and some other request specific information
and add it to session to be able to determine where the user is from history

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Tim Marsden" <TM***@newsgroup.nospam> wrote in message
news:28**********************************@microsof t.com...
Hi,

I have a web form which displays some information based on criteria I
store
in the session. When the user interacts with the page it is changed and
session changed accordingly. The use can navigate from the page ok, if
they
click back all is ok because the session still relates to the page.
However
there may be a situation when the user navigates to a new version of the
page
(type in the url etc). How I have a page in the browser history to which
the
user can use the back button to navigate to, to which the current values
in
the session have no relation.

Here's what I want to do, if the user presses back, detect the page does
not
match the session and update the page with the current session values. But
the page load event is not fired, so how do I trigger my update code.

--
Tim Marsden


Nov 19 '05 #4
It sounds as if you need to store more than one entry in your session state.
One for the previous state of things, and then one for the current state
of things. You'll need to then detect in your page which one to use.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,

I have a web form which displays some information based on criteria I
store in the session. When the user interacts with the page it is
changed and session changed accordingly. The use can navigate from the
page ok, if they click back all is ok because the session still
relates to the page. However there may be a situation when the user
navigates to a new version of the page (type in the url etc). How I
have a page in the browser history to which the user can use the back
button to navigate to, to which the current values in the session have
no relation.

Here's what I want to do, if the user presses back, detect the page
does not match the session and update the page with the current
session values. But the page load event is not fired, so how do I
trigger my update code.


Nov 19 '05 #5
Hi Tim,

I think the problems here is that when the user hit the "back" button on
browser, the displayed page is by default retrieved from the client's
cache(if we didn't explictitly disable the page's client cache). I think
that's why you'll find the Page_load not fired. IF the page is actually
retrieved from severside , the Page_load will surely be fired.
In addition, as for detecting whether the page is requested the first time
or specifying a version info, I think we can add a certain version field(a
timestamp) in the page's viewstate at the first request( !IsPostBack), and
if there is no such field , it means it's the first request or if the info
is different from the session's data, we need to update the page. But this
depends on the page is not retrieved from client cache when user hit "back"
button. How do you thnk of this?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6
Thanks Steven,

I can place a time stamp on the page, and then one in the session, if they
match the session is for the page, ok I understand that. But what I am
struggling with is how to test the page timestamp against the session if
there is no event fired when the page is displayed via the back button. If I
could detect the page being loaded I could refresh it with the current
session info. I can set up a JavaScript function which is fired onload, but
can I link this into my vb code behind.

An example might be a banking app. I logon on and view my balance. After
navigation away from the page I return via the back button. It does not show
me the balance page but displays the logon page for my account.

Regards
Tim
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:er*************@TK2MSFTNGXA03.phx.gbl...
Hi Tim,

I think the problems here is that when the user hit the "back" button on
browser, the displayed page is by default retrieved from the client's
cache(if we didn't explictitly disable the page's client cache). I think
that's why you'll find the Page_load not fired. IF the page is actually
retrieved from severside , the Page_load will surely be fired.
In addition, as for detecting whether the page is requested the first time
or specifying a version info, I think we can add a certain version field(a
timestamp) in the page's viewstate at the first request( !IsPostBack), and
if there is no such field , it means it's the first request or if the info
is different from the session's data, we need to update the page. But this
depends on the page is not retrieved from client cache when user hit
"back"
button. How do you thnk of this?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #7
Thanks for your followup Tim,

As for the
==================
. I logon on and view my balance. After
navigation away from the page I return via the back button. It does not
show
me the balance page but displays the logon page for my account.
==================

what's the logon page? Are you using the Forms based authentication to
protect your page? If so, is this behavior caused by the user's
authentication session timeout?

Also, since your balance page need to be accurate and sychronous, I suggest
that you disable the clientside cache for that page. Thus, when the user
trying to hit "back " button at client browser to navigate back to the
balance page, it will get a "content expired error message" or just request
the page again from the serverside. Then, as long as the page is requested
from serverside, we can detect the entering of the Page_Load event.(If
still have no luck with the Page_Load, there must have some other things
incorrect with the page). To disable clientside cache for a page, we can
add the following statements in Page_Load:

private void Page_Load(object sender, System.EventArgs e)
{
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
}
Also, here are some public articles describing this:

http://blog.u2u.info/DottextWeb/gert...01/17/808.aspx

http://www.c-sharpcorner.com/asp/Art...ngInASPDPL.asp

HTH. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




Nov 19 '05 #8

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

Similar topics

4
by: Chad Crowder | last post by:
I've taken a look at this article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp12282000.asp which someone posted a month or so ago regarding setting up SQL...
2
by: John A Grandy | last post by:
for high traffic public websites , what are the proven options for session-state storage & management ? is an out-of-process state-server generally preferred over a sql-server ? what are the...
1
by: John Grandy | last post by:
Could someone point me in the direction of good discussions on scalable state management solutions? Specifically, pros and cons of following strategies: Strategy 1 : temporary business-objects...
2
by: geodev | last post by:
Hello, I’m currently writing an asp.net application that will be running on a Windows XP Professional workstation utilising IIS and MSDE Database. At a later date this application will need to...
13
by: James Hunter Ross | last post by:
We love the ASP.NET "Session" concept and make good use of it. But, getting close to deployment we find we lose sessions far too often, probably due to application restarts, etc. We hope to...
0
by: Shell | last post by:
Hi All, We have an application that uses SQL Server 2000 for State Management data. We previously use to build and deploy this application using ASP.NET Beta 2 version. Now we are using ASP.NET...
5
by: knyghtfyre | last post by:
Hello, My company is developing a rather large application with .NET 2.0. We are expanding to a server farm and are in the process of converting our application to use an out-of-process session...
4
by: =?Utf-8?B?Z3V5?= | last post by:
Is this a valid approach to State Management? What I do is define a class 'State' which holds all the objects etc. that I need to store in the Session. I can then get my state object and...
0
by: kirk | last post by:
I have three events that I have created and manage with timers. Two of the timer event handlers, the last two in the code below, need to reset state management data, if the first event handler...
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: 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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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.