Setting Session within Method?

  • Thread starter Thread starter thdevdex
  • Start date Start date
T

thdevdex

Needless to say I'm new to .Net. I'm trying to set Session variables
from within a method within a class.

(Name "Session" is not declared) is the message I get while typing in
the code. I don't get this while entering code within an .aspx.vb file.
Obviously I need to create and instance of some System.Web... object but
I don't know what it is. Any ideas?

Also by setting session variables from within the class and not sending
back values by properties, is this breaking some object oriented
concept?
 
Simply use the full namespace from within your class:
System.Web.HttpContext.Current.Session
 
I added that and it works fine, thanks. One more question.

I normally try to get answers from the VS2003 documentation and when I
was researching which object to use, the documentation for Session was
yapping about the HttpSessionState object. Is there a recommended area
within the documentation to figure out the appropriate system objects to
use and when?
 
Back
Top