Sounds like you can refer to your session variable in one of two ways:
Page.Session(HitsKey) or Page.Session("my_session_key") where
"my_session_key" is whatever string value that was assigned as the key.
For both of these to return the same session value then HitsKey must be
defined like so:
Dim HitsKey As String = "my_session_key"
Sounds like they made HitsKey a property value for the server control so
that somebody could set what that text value key should be. As opposed to
hard-coding it in the server control as (for example) "my_session_key".
They are trying to encapsulate the server control and hide all the messy
details. One of those details is the session key's name. But you can't
really fully encapsulate a session variable, because the rest of the program
still has access to your session and not just through your server control.
Am I making sense? Probably not. :^)
Greg
"G Dean Blake" <gb@nospam.com> wrote in message
news:uk**************@TK2MSFTNGP15.phx.gbl...
But... if they want to refer to the session variable they should use
Page.Session("HitsKey") with Quotes. if they want to refer to the
property they should just say HitsKey. I have always enclosed my session
variables in quotes when writing in VB. I guess I don't know the meaning
when the quotes are not used. am I making sense?
"Richard Myers" <fa**@address.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"G Dean Blake" <gb@nospam.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl... This code is actually inside a servercontrol where there is a property
named HitsKey but also there is code using a session and application variable
named "HitsKey". What I don't understand is why if they simply want to
refer to the property why not just say HitsKey instead of
Page.Session[HitsKey] (I don't know why they chose to name a session
variable and a property by the same name.) It's actually code from a
book on writing servercontrols.
Thanks,
G
You've kinda answered your own question there G.
They want to refer to the session(HitsKey) not the server control
property
HitsKey that contains this code.
If they just used HitsKey then they would get a reference to the
Propertry
not the session var.
Richard