I can't write Page.ViewState

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello!

The reason I can't write Page.ViewState must depend on that ViewState
property is defined as protected so
must be accessed from a class that is derive from the Page class.
The normal way to access ViewState from within the Default class below is to
write
this.ViewState or just ViewState.
Is my understanding correct ?
public partial class Default : System.Web.UI.Page

//Tony
 
The reason I can't write Page.ViewState must depend on that ViewState
property is defined as protected so
must be accessed from a class that is derive from the Page class.
The normal way to access ViewState from within the Default class below
is to write
this.ViewState or just ViewState.
Is my understanding correct ?
public partial class Default : System.Web.UI.Page

ViewState has protected access. The semantics of protected access
are well known.

Note that the property only has a get not a set. You can not
replace the bag - only add items to it or remove items from it.

Arne
 
The reason I can't write Page.ViewState must depend on that ViewState
property is defined as protected so
must be accessed from a class that is derive from the Page class.
The normal way to access ViewState from within the Default class below is to
write
this.ViewState or just ViewState.
Is my understanding correct ?
public partial class Default : System.Web.UI.Page

I am wondering about that also. I want to kill my session when my
msgProcessor class receives the logout message, but Session[] and
Application[] do not seem to be accessible, so I am thinking of
returning a special value to it. Adding a public method might be
another option.

The session object has among other the following two methods:
Clear
Abandon

One of them may do what you want.

Arne
 
Back
Top