How to access a Session variable in a Class written in C#?

Session["FilterID"] -- It is a session variable assigned in different page

Inside the C# Class, You can get it using the following Code.

class sample
{
method()
{
int FilterID = Convert.ToInt32(HttpContext.Current.Session["FilterID"]);


// HttpContext.Current.Session["variable"] - is used to get the session variable
}
}

No comments: