473,500 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keep track of Session value

Hi there,

Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application. I
am just wondering if anyone have any experience on how to keep track of
session value. Any help it's appreciated.

Thanks

Alan
Nov 19 '05 #1
3 2888
This is really not an answer to your questions, but you might want to
refactor the code design.

Session variables are nothing more than "fancy" global variables. And just
like the way you might avoid the use of global variables in a normal
application, the same reasoning should be applied to session variables.
That is not to say that global/session variables are not important -- they
have their place -- but it is important to be able to rationalize why you
use them rather than just saying something like "they are convenient."

Having said that, here is my take on your question.

What do you mean "keep track of"? Do you mean being able to know what parts
of code are setting a particular variable or simply that you want a list of
session variables in use? In the past, if I wanted to use session
variables, I have often encapsulated the getting and setting behind some
other class that centralizes the action. Essentially there would then be
only one place in the entire code that sets or gets the value directly from
the session (that is there was only one call to Session["..."]). By doing
this, you can 1) centralize access to the variable, 2) be able to group
related session variables together, and 3) Be able to enforce consistency
like suppose that variable "foo" could only be set if variable "bar" is
null, then properties could help enforce that.

"Alan Wang" <wa**@vdata.com> wrote in message
news:O3***************@TK2MSFTNGP10.phx.gbl...
Hi there,

Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application.
I am just wondering if anyone have any experience on how to keep track of
session value. Any help it's appreciated.

Thanks

Alan

Nov 19 '05 #2
>>Do you mean being able to know what parts
of code are setting a particular variable or simply that you want a list of
session variables in use?

Probably both. Sometimes I just lost keep track of where I used this Session
variable and why use this session variable especially when you didn't touch
that code for a while. For regular variable, I can use "go to definition"
and then be able to find where I defined this variable and data type. But I
can't do it with Session variable. That's something really bothers me. Do
you have any solution or suggestions for that.

Thanks in advanced

Alan

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Oq****************@TK2MSFTNGP12.phx.gbl...
This is really not an answer to your questions, but you might want to
refactor the code design.

Session variables are nothing more than "fancy" global variables. And
just like the way you might avoid the use of global variables in a normal
application, the same reasoning should be applied to session variables.
That is not to say that global/session variables are not important -- they
have their place -- but it is important to be able to rationalize why you
use them rather than just saying something like "they are convenient."

Having said that, here is my take on your question.

What do you mean "keep track of"? Do you mean being able to know what
parts of code are setting a particular variable or simply that you want a
list of session variables in use? In the past, if I wanted to use session
variables, I have often encapsulated the getting and setting behind some
other class that centralizes the action. Essentially there would then be
only one place in the entire code that sets or gets the value directly
from the session (that is there was only one call to Session["..."]). By
doing this, you can 1) centralize access to the variable, 2) be able to
group related session variables together, and 3) Be able to enforce
consistency like suppose that variable "foo" could only be set if variable
"bar" is null, then properties could help enforce that.

"Alan Wang" <wa**@vdata.com> wrote in message
news:O3***************@TK2MSFTNGP10.phx.gbl...
Hi there,

Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application.
I am just wondering if anyone have any experience on how to keep track
of session value. Any help it's appreciated.

Thanks

Alan


Nov 19 '05 #3
When I need to find session variables, I simply search the whole project for
the string "session[". Then I catalog all the variables that I find and
where they are accessed.

"Alan Wang" <wa**@vdata.com> wrote in message
news:ue**************@TK2MSFTNGP12.phx.gbl...
Do you mean being able to know what parts

of code are setting a particular variable or simply that you want a list
of
session variables in use?

Probably both. Sometimes I just lost keep track of where I used this
Session
variable and why use this session variable especially when you didn't
touch
that code for a while. For regular variable, I can use "go to definition"
and then be able to find where I defined this variable and data type. But
I
can't do it with Session variable. That's something really bothers me. Do
you have any solution or suggestions for that.

Thanks in advanced

Alan

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Oq****************@TK2MSFTNGP12.phx.gbl...
This is really not an answer to your questions, but you might want to
refactor the code design.

Session variables are nothing more than "fancy" global variables. And
just like the way you might avoid the use of global variables in a normal
application, the same reasoning should be applied to session variables.
That is not to say that global/session variables are not important --
they have their place -- but it is important to be able to rationalize
why you use them rather than just saying something like "they are
convenient."

Having said that, here is my take on your question.

What do you mean "keep track of"? Do you mean being able to know what
parts of code are setting a particular variable or simply that you want a
list of session variables in use? In the past, if I wanted to use
session variables, I have often encapsulated the getting and setting
behind some other class that centralizes the action. Essentially there
would then be only one place in the entire code that sets or gets the
value directly from the session (that is there was only one call to
Session["..."]). By doing this, you can 1) centralize access to the
variable, 2) be able to group related session variables together, and 3)
Be able to enforce consistency like suppose that variable "foo" could
only be set if variable "bar" is null, then properties could help enforce
that.

"Alan Wang" <wa**@vdata.com> wrote in message
news:O3***************@TK2MSFTNGP10.phx.gbl...
Hi there,

Once my application gets complicated and complicated. I found it's
really hard to keep track of Session value I am using in my asp.net
application. I am just wondering if anyone have any experience on how
to keep track of session value. Any help it's appreciated.

Thanks

Alan



Nov 19 '05 #4

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

Similar topics

3
3189
by: Alex Thomas | last post by:
This is my problem. I want to submit a form to another page to process the data from said form. Then the person can go on to another part of the site or another site altogether. However If the...
1
4440
by: d.schulz81 | last post by:
Hi all, We have about 10 different domains that are linked very closely and we want to identify and keep track of every single user that surfs our websites by the use of sessions. The problem...
2
4161
by: Uwe Range | last post by:
Hi to all, I am developing a database where, with time, it proved to be necessary to keep track of the changes to the data. It is fairly easy to keep track of the time when a record was changed...
3
2223
by: RR | last post by:
We have cards that are numbered consecutively. These cards are given out to different people in different sized batches. One group might get 5, the next group might get 20. What is a good...
3
6329
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want...
5
3691
by: tshad | last post by:
If I am using FormsAuthentication, is there a way to check who is logged in? I want to be able to check at any particular time, not just how many people are logged in, but who they are. One...
7
2326
by: andrea | last post by:
Which is the best way to track the number of the user currently logged into a web site? I've some idea on mind, but I want to compare with you. One could be to increment a session variable on...
2
2071
by: Don Hobson | last post by:
I am building a website and I want to allow users to do certain things without logging in. I would like to allow them to keep track of certain items, by adding them to a list. Like if they are...
0
7136
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
7018
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
7182
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
7232
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...
1
4923
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...
0
4611
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...
0
3110
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...
0
1430
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 ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.