Is
System.Web.HttpContext.Current.Session
the same as
System.Web.UI.Page.Session
?
Many thanks in advance.
Is
System.Web.HttpContext.Current.Session
the same as
System.Web.UI.Page.Session
?
Many thanks in advance.
They do indeed refer to the same instance, but if you look at the methods in Reflector, you can see that they behave a bit differently (in ways that are not likely to matter in most applications):
Page.Session
uses a
cached HttpSessionState
reference.Page
method will throw if
session state is not enabled, while
HttpSessionState.Session
just
returns whatever is in the
"AspSession" bucket of its Items
collection.