State Access in ASP.NET

there is

System.Web.HttpContext.Current.Session

same as

System.Web.UI.Page.Session

?

+3
source share
3 answers

They actually refer to the same instance, but if you look at the methods in Reflector , you will see that they behave a little differently (in most cases this is unlikely):

  • The call Page.Sessionuses cached HttpSessionState.
  • The method Pagewill HttpSessionState.Sessionreturn if the session state is not enabled, while it simply returns everything that is in the Bucket "AspSession" its Items collection.
+6
source

Yes; they refer to the same instance.

+5

.

+2
source

Source: https://habr.com/ru/post/1765824/


All Articles