Wednesday, March 28, 2012

What is sessions namespace?

I want to manage session in a class's property like:

public class HealthSession
{
private int SelClassID, SelGradeID;

public int ClassID_Sel
{
get
{return Session["ClassID_Sel"];}
set
{Session["ClassID_Sel"]=value;}
}

What is session's namespace?System.Web.UI

regards,
You'll need more than just the namespace, you'll need an object with a
Session property. Session["foo"] works inside of a method in a webform
class because the Page object has a Session property.

Hint: look at HttpContext.Current ...

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 18 Mar 2005 14:55:21 +0800, "ad" <ad@.wfes.tcc.edu.tw> wrote:

>I want to manage session in a class's property like:
> public class HealthSession
> {
> private int SelClassID, SelGradeID;
> public int ClassID_Sel
> {
> get
> {return Session["ClassID_Sel"];}
> set
> {Session["ClassID_Sel"]=value;}
> }
>
>What is session's namespace?

0 comments:

Post a Comment