G
Guest
Good day,
I have a question about the Page.Session property used in ASP.NET
This property is defined as follows:
public virtual HttpSessionState Session {get;}
and HttpSessionState is a sealed class derived from System.Object and it has
two indexers one integer and on string. For example the following code can be
used to set a Session variable in a web page.
Page.Session["myPage"] = new aClass();
and then it can be retrieved as follows:
aClass ac = (aClass)Page.Session["myPage"];
I will really help if someone could explain how this is possible.
Page.Session is a readonly property afterall. Another thing I don't
understand is that how can you treat Page.Session as an indexer?
I appreciate any clarification.
I have a question about the Page.Session property used in ASP.NET
This property is defined as follows:
public virtual HttpSessionState Session {get;}
and HttpSessionState is a sealed class derived from System.Object and it has
two indexers one integer and on string. For example the following code can be
used to set a Session variable in a web page.
Page.Session["myPage"] = new aClass();
and then it can be retrieved as follows:
aClass ac = (aClass)Page.Session["myPage"];
I will really help if someone could explain how this is possible.
Page.Session is a readonly property afterall. Another thing I don't
understand is that how can you treat Page.Session as an indexer?
I appreciate any clarification.