472,968 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,968 software developers and data experts.

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 2846
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
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
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
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
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
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
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
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
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
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.