Hardy ,
That basically means that the HttpHandler that process the request is not
marked with one of the marker interfaces IRequiresSessionState or I
ReadOnlySessionState. In this case Session won't be created, but other think
like Cache for example will be avavilable.
This can happen if you have written your own HttpHandler or the page has
been set up not to have session state.
For the latter check if the @ Page directive in aspx file doesn't have
EnableSessionState=false. Also check if the session state is not disabled in
the web.config file - sessionState element's mode attribute doesn't have to
be *Off*.
--
HTH
Stoitcho Goutsev (100)
"Hardy Wang" <ha*******@newsgroups.nospam> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a web application, code of ASPX page needs to call one static
method in another class which does not inherit System.UI.Page class
using System.Web;
public class Utils {
public static void GetSessions() {
HttpContext ctx = HttpContext.Current;
ctx.Session; // not available. <undefined value>
ctx.Cache; // Yes!! I can access.
}
}
If I place a quick watch on ctx variable, I noticed Session is not
availble to use, but Cache is ready.
Anybody has idea how can I access Session objects from other class? And
why I cannot access it via HttpContext?
Thanks for any suggestion.
--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy