473,667 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3454
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*********@31 1.com> wrote in message
news:OZ******** ******@TK2MSFTN GP09.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*********@31 1.com> wrote in message
news:OZ******** ******@TK2MSFTN GP09.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/windowsserver20 03/proddocs/standard/aaconaspnetauth entication.asp

http://msdn.microsoft.com/library/de...us/vsent7/html
/vxconASPNETAuth entication.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
1689
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 response.redirect to the home page. this works for on the normal site, but session state info is dying on the demo subdomain. i'm sure the session info is being written since i can see it when i response.write the value. also, the response.redirect uses a...
4
2245
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
5153
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. In other words, different web servers may serve different requests in the SAME session. In non-mobile ASP.NET, my understanding is that the view state information is passed between each client browser and server with every post-back. Even if...
1
2894
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 state slot. I'm using InProc session state. After the user goes through the paypal site, the session information I collected / saved is gone. Is there a way to maintain state across domains without resorting to ugliness like saving the session...
3
3311
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. Any idea what could cause this? I have the mode="InProc" attribute set for <sessionState>. I know that some people have solved the problem of session variables timing out too quickly by changing that attribute, but I cannot use...
3
290
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 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...
1
2171
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 narrow down the results. The grid also contains a column with hyperlinks which when clicked should invoke the second page which displays details about the current row. I call the second page with Server.Transfer("second.aspx"). On this page I...
7
10345
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 hierarchy of the menu tree. All pretty normal stuff. Is there any simple method of maintaining the expanded / collapsed state of each node as my application moves from page to page? Remember this is on a master page used by numerous content...
11
7905
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 applications. As far as I can see, the Session approach is non-standard since Web Services are supposed to be agnostic with respect to their clients. It seems that cookies are outside the Web Service standard; therefore, such a Web Service application...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8561
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8645
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5672
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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 we have to send another system
2
1778
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.