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

Maintain state after session dies

This is a very open ended question. I have an app with a page that uses link
buttons to change the display. On the prior page you have a list of objects.
You click one of those objects to see it's details. I have nav Link buttons
that allow you to go to previous or next object from the object list on
previous page. In the command event of the linkbutton, the page is redrawn
with the details of the next or previous object. I am using viewstate to
maintain the id of the current object, which is used in the command event to
grab the next or previous object's id which is used to get the info to
populate the page. This new object's id is again saved to viewstate. I am
using a session object to maintain state. This app is part classic, part
..net, so i'm not using forms authentication.

The question I have is when my session runs out, I want to be able to
redirect the user back to the view they were at when their session timed out
(after they successfully re-login).

So what are some ideas on how I maintain this state that is saved in
viewstate?

Right now I check my session in a user control. I think I'm going to redo
this because the page must load before the user control loads. I was
thinking of putting the check in the Begin_request event in global.asax
instead so that the page never runs without the user being authenticated. Is
this is decent strategy, or should I do something else. If this is OK, then
use this scenario to answer my original question.

thanks a bunch!
Jul 19 '05 #1
3 3431
If I understand this correctly there are two issues you want to resolve.

1. Maintaining state when session runs out and
2. A proper authentication strategy

For (1) you will need to maintain current object id for the user in the
database or some permanent storage (local file etc) so that when the user
logs in again, after the session has run out, you read that id and populate
the page appropriately.

For (2) I would simply use the .config file to ensure people don't reach a
page unless they are authenticated.

HTH.

<ma*********@311.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl...
This is a very open ended question. I have an app with a page that uses link buttons to change the display. On the prior page you have a list of objects. You click one of those objects to see it's details. I have nav Link buttons that allow you to go to previous or next object from the object list on
previous page. In the command event of the linkbutton, the page is redrawn
with the details of the next or previous object. I am using viewstate to
maintain the id of the current object, which is used in the command event to grab the next or previous object's id which is used to get the info to
populate the page. This new object's id is again saved to viewstate. I am
using a session object to maintain state. This app is part classic, part
.net, so i'm not using forms authentication.

The question I have is when my session runs out, I want to be able to
redirect the user back to the view they were at when their session timed out (after they successfully re-login).

So what are some ideas on how I maintain this state that is saved in
viewstate?

Right now I check my session in a user control. I think I'm going to redo
this because the page must load before the user control loads. I was
thinking of putting the check in the Begin_request event in global.asax
instead so that the page never runs without the user being authenticated. Is this is decent strategy, or should I do something else. If this is OK, then use this scenario to answer my original question.

thanks a bunch!

Jul 19 '05 #2
Did you consider cookies?

<ma*********@311.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl...
This is a very open ended question. I have an app with a page that uses link buttons to change the display. On the prior page you have a list of objects. You click one of those objects to see it's details. I have nav Link buttons that allow you to go to previous or next object from the object list on
previous page. In the command event of the linkbutton, the page is redrawn
with the details of the next or previous object. I am using viewstate to
maintain the id of the current object, which is used in the command event to grab the next or previous object's id which is used to get the info to
populate the page. This new object's id is again saved to viewstate. I am
using a session object to maintain state. This app is part classic, part
.net, so i'm not using forms authentication.

The question I have is when my session runs out, I want to be able to
redirect the user back to the view they were at when their session timed out (after they successfully re-login).

So what are some ideas on how I maintain this state that is saved in
viewstate?

Right now I check my session in a user control. I think I'm going to redo
this because the page must load before the user control loads. I was
thinking of putting the check in the Begin_request event in global.asax
instead so that the page never runs without the user being authenticated. Is this is decent strategy, or should I do something else. If this is OK, then use this scenario to answer my original question.

thanks a bunch!

Jul 19 '05 #3
Hi,

I agree with the answer from Sanjay. In addition, please remember to save
the user information (say, user name) together with the object's id.

For ASP.NET Authentication, I believe the following articles are helpful:
http://www.microsoft.com/technet/tre...hnet/prodtechn
ol/windowsserver2003/proddocs/standard/aaconaspnetauthentication.asp

http://msdn.microsoft.com/library/de...us/vsent7/html
/vxconASPNETAuthentication.asp

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Jul 19 '05 #4

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

Similar topics

4
by: Dica | last post by:
we've just set up a subdomain, 'demos' for one of our projects that normally works fine. on the login page, if the user enters the correct username/pw, we write session info and then...
4
by: Oscar Onorato | last post by:
Hello colleagues: Somebody know that good alternatives I have, in addition to the cookies, to maintain the session state? Where an example of it can be seen? Thanks
5
by: Dominic | last post by:
My question is about how to maintain view state in mobile ASP.NET across postback / request in a web farm environment. First of all, let's assume the web-farm does NOT use stick-session feature....
1
by: Robert Burdick [eMVP] | last post by:
Hello All: I am writing an ASP.NET application that will take the user to PayPal to make some payments. Before going to PayPal, I collect relevant user information and store it in a session...
3
by: bennett | last post by:
In the web.config file for my application, in the <sessionState> section I have set timeout="120" (in minutes), but session state variables in my application seem to be expiring in about 5 minutes....
3
by: | last post by:
This is a very open ended question. I have an app with a page that uses link buttons to change the display. On the prior page you have a list of objects. You click one of those objects to see it's...
1
by: darin_dimitrov | last post by:
I have an application which consists of 2 web forms. On the first page I have a datagrid with paging and sorting turned on. I also have a textbox which allows me to filter the data in the grid and...
7
by: Andrew Robinson | last post by:
I have a treeview control that I use as a menu & navigation control within a master page. The nodes for this control are loaded from a database which contains the text and url of each like and the...
11
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web...
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: 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...
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
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,...
0
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...

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.