Setting Session within Method?

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?
 
S

Steve C. Orr, MCSD

Simply use the full namespace from within your class:
System.Web.HttpContext.Current.Session
 
T

thdevdex

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top