Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add Session varaible in an ordinary class

Reply
Thread Tools

Add Session varaible in an ordinary class

 
 
RonL
Guest
Posts: n/a
 
      04-02-2006
I'm unable to add a session variable in a non-page class. Any ideas?

I've tried

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session["ABC"] = messageBody;



also

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session.Add("ABC", messageBody");



also



HttpContext current = HttpContext.Current;

current.Session["ABC"] = messageBody;



Ron


 
Reply With Quote
 
 
 
 
RonL
Guest
Posts: n/a
 
      04-02-2006
I jsut noticed that it does not work if there no session variables exist. If
I add a different Session variable in a start up page then it works fine.

Ron


"RonL" <(E-Mail Removed)> wrote in message
news:5WEXf.7443$(E-Mail Removed) m...
> I'm unable to add a session variable in a non-page class. Any ideas?
>
> I've tried
>
> System.Web.SessionState.HttpSessionState session =
> HttpContext.Current.Session;
>
> session["ABC"] = messageBody;
>
>
>
> also
>
> System.Web.SessionState.HttpSessionState session =
> HttpContext.Current.Session;
>
> session.Add("ABC", messageBody");
>
>
>
> also
>
>
>
> HttpContext current = HttpContext.Current;
>
> current.Session["ABC"] = messageBody;
>
>
>
> Ron
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display varaible on LCD jhduplessis VHDL 0 11-07-2007 07:51 AM
What is the correct grammar to make a function call by using static member data which is a pointer to a ordinary class member function? zaeminkr@gmail.com C++ 3 07-06-2007 12:50 PM
voipfone question: can i use on my pc with ordinary headphone and mic? OM UK VOIP 2 09-21-2005 10:05 PM
Constructors are having a special signature, different from ordinary member functions ? Razvan Java 1 09-30-2004 06:12 PM
Is varaible name case sensitive? Hang ASP General 3 07-10-2003 08:21 AM



Advertisments