There's no easy way to know where a class resides (except for searching
through the online help).
Normally when you are in codebehind, Session is available as a property of
the Control class your Pages, User Controls and Server Controls inherit
from. In reality however, the real property is exposed by the HttpContext
object. Each request runs within an HttpContext. You can get a reference
to the current context being executed via System.Web.HttpContext.Current,
and from that access the Session:
dim context as HttpContext = HttpContext.Current
Context.Session.Add("SomeNewSession", "SomeId")
note howeverthat HttpContext.Current could return null/nothing if the class
file isn't being used from a web request (say for example, if you were
planning on using it for a windows form as well). Since this probably won't
be the case, no problem...but it's also good practice to check things
properly:
dim context as HttpContext = HttpContext.Current
if context is nothing then
throw new ApplicationException("This method must be called within a web
context")
end if
is a simple option :)
You might wanna check:
http://openmymind.net/DataStorage/index.html I have
a little blurb about doing just this (though there isn't more to it that
what I've said here).
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"hansiman" <ha***@hotmail.com> wrote in message
news:4p********************************@4ax.com...
Thanks... coming from classic asp I often have a hard time figuring
out what namespaces to specify in the "imports" sesion of a class
file.
Now, for instance, I need to use session(X) in the same class file,
and get the same type of "syntax error". How do I find out what
namespaces to declare?
On Fri, 26 Nov 2004 18:32:42 -0500, "Karl Seguin" <karl REMOVE @
REMOVE openmymind REMOVEMETOO . ANDME net> wrote:
Try System.Web.HttpRuntime.Cache
Karl