In an MVC 1.0 C# app, what's the different between the following:
HttpContext.Current.Session["MyValue"] = "ItsValue";
and
Session["MyValue"] = "ItsValue";
In an MVC 1.0 C# app, what's the different between the following:
HttpContext.Current.Session["MyValue"] = "ItsValue";
and
Session["MyValue"] = "ItsValue";
Session["MyValue"]
is accessing a property of the ViewPage object. I you're trying to get to the session from another class which isn't a ViewPage, you'd use HttpContext.Current.Session["MyValue"];
They are equivalent in that they reference the same object.
HttpContext.Current.Session == this.Session