I have the following Session variable: Session["UserId"];
How can I save this variable in the class and public variables? Something like this:
public class UserDC
{
//public static Session UserId = Session["UserId"]
}
I only want to call: UserDC.UserId.
Is this what you are looking for?
Edit:
In order to get a Session variable within a static property or static method, you must actually do the following because
HttpContext.Currentis static: