It's hard to tell from your message WHEN and WHERE you want to re-use these
variables, and that makes all the difference in terms of how you would
store/persist them. The Page class is re-instantiated and destroyed with
each Page request. So, if you don't need the values to survive PostBacks
(for example, if you want to use them in the Page_Init and Page_Load
methods), you can store them in the class as fields or properties. If you
need them across PostBacks, but only within the one Page, you can store them
in ViewState. ViewState is maintained by using a hidden form field in the
client, which is posted back to the server and updated with each PostBack.
Note, however, that, as ViewState is rendered in a hidden form field in the
Page, it's not a good idea to store anything very large in there. If you
want to use them across multiple pages, but only for a single user Session,
then storing them is SessionState makes sense. If you want them to be
globally available to all Pages and all user Sessions, you can store them in
There are a few other places as well, but this hits the high points.
The more I learn, the less I know.
"Micke Palm" <nykoping.net> wrote in message