By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,990 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,990 IT Pros & Developers. It's quick & easy.

Keep track of Session value

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
>>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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.