local data of a Page

  • Thread starter Thread starter R.A.M.
  • Start date Start date
R

R.A.M.

Hello,
I am learning ASP.NET. I need to keep some information for a Page-derived
object (.aspx page). May I use private members or should I use ViewState of
other mechanism? I ask because the information mentioned should be available
across page-reloads.
Could you help me plase?
Thank you very much!
/RAM/
 
Hi,

R.A.M. said:
Hello,
I am learning ASP.NET. I need to keep some information for a Page-derived
object (.aspx page). May I use private members or should I use ViewState of
other mechanism? I ask because the information mentioned should be available
across page-reloads.
Could you help me plase?
Thank you very much!
/RAM/

The Page object is created when the request arrives, and is then
destroyed after the response is sent. Private variables are not kept
across page-reloads.

There are multiple ways to keep information across page-reloads.
Viewstate is one, but it has the disadvantage that it is sent to the
client and back to the server every time, which causes an increase in
traffic.

Other ways are:

- Session state (only available on the server)
- Cookies (also sent back and forth)
- Hidden fields (also sent back and forth)


HTH,
Laurent
 
Back
Top