473,789 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global Session Variables and Session State

I what to create global variables that are based on the user session. I
created a class that is instanced on session_start and hold all the users
global variables within that class. This works great unil the user stays on
the page for more then the timeout period (20 minutes or whatever) Then when
they click a link the next page breaks because the current session has timed
out . Because ASP.NET rebuilds the old page and then fires the event, if a
session varialbe has timed out, then it messes up the loading of that page
and causes an error. I sure wish that there was a way of delcaring an
instance class that could be global accross all pages of the web site.

Thanks for your input

Earl
Nov 18 '05 #1
1 1243
The problem you are having is related to transfering information from one
page to another. Depending on how you transfer to another page, you need to
re-adjust your class. Transfering methods are overloaded with the second
parameter usually determining how the form variables and state is preserved.
You need to use this as a guide for your class as well. For example, if you
do a page transfer and set the preserve form to false, you need to clear out
your class values and re-initialize to keep it in sync. I think that is all
you are missing to make this work.

--
Regards,
Alvin Bruney
Got DotNet? Get it here...
http://www.networkip.net/dotnet/tidbits/default.htm
"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:ez******** ******@TK2MSFTN GP11.phx.gbl...
I what to create global variables that are based on the user session. I
created a class that is instanced on session_start and hold all the users
global variables within that class. This works great unil the user stays on the page for more then the timeout period (20 minutes or whatever) Then when they click a link the next page breaks because the current session has timed out . Because ASP.NET rebuilds the old page and then fires the event, if a
session varialbe has timed out, then it messes up the loading of that page
and causes an error. I sure wish that there was a way of delcaring an
instance class that could be global accross all pages of the web site.

Thanks for your input

Earl

Nov 18 '05 #2

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

Similar topics

1
4371
by: mark4asp | last post by:
What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include that file on every page. This is the best way of doing it - is it not? Once the application has loaded the page it is cached and is immediately available for other pages. With global variables - the best thing to do would be to use application variables - so long as there weren't too many...
17
5633
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm constantly running tests on imperfect code. On of the cumbersome jobs encountered is reassigning global vars their values after a close encounter with an untrapped runtime error. Rather than writing a procedure to simply reassign them all with a...
4
3538
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public myVar as string, etc. It seems to me that the scope and duration are the same, as they both are there while the application is running, and both go away when it quits. I presume that one difference is that the application state can be "flushed," such...
2
1395
by: starbuck | last post by:
Hi My first vb.net/asp.net application is taking shape now and I have started using session state to store user variables or type string, long and bool.. The VB6 app I am converting also makes great use of global variables as per the example below Structure Gen_setup Dim Nominal As Long
2
5214
by: Nathan Sokalski | last post by:
I would like to access variables and functions that I declare in the Global.asax.vb file. However, I am having trouble doing that. What does the declaration have to look like in the Global.asax.vb file, and what would I do to access it? (I am using VB.NET for my code) Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
2
7861
by: stewartfip | last post by:
My global.asax file looks something like this: sub Session_Start() session("sessionID") = end sub sub Application_PreRequestHandlerExecute() if session("sessionID") <> 0 then
11
2352
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
1
1017
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: How can I make my variable as global or variable that declared in all my entire project. For Example in Desktop application you can add your variable to the Module to make declared for the entire project. How can I do So in my web Application?
6
2566
by: Frank Swarbrick | last post by:
Interesting! I was going to ask if such a thing existed, but I was pretty much convinced they did not so I didn't ask. Looks like with version 9.5 DB2 supports global variables: "Global variables improve data sharing between SQL statements. Version 9.5 introduces the concept of global variables, which are named memory variables that you can access and modify through SQL statements. Global variables enable you to share data between...
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
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...
0
10193
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
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
9016
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...
0
6761
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
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
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

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.