ASP.NET viewstate question

N

nologo

i wish to store a users custom role in a viewstate...
is this advised?or shall i use profiles?
sorry im a new comer to asp.net so not sure of all the tricks etc.
 
P

Peter Morris

sorry im a new comer to asp.net so not sure of all the tricks etc.

One good trick is to use the aspdotnet group :)
 
A

Alberto Poblacion

nologo said:
i wish to store a users custom role in a viewstate...
is this advised?or shall i use profiles?
sorry im a new comer to asp.net so not sure of all the tricks etc.

The ViewState only applies to the current page; it will be lost as soon
as the user navigates to a different page. So it wouln't be adequate for
storing a user's role.
Profiles might be a good choice depending on what you mean by "custom
role". Other alternatives would be the Session state, or a Cookie, or a
GenericIdentity in the current Thread, depending on what you are trying to
accomplish, how you manage roles and when you wish to apply them. Have you
taken a look at the built-in RoleManager?
 
I

Ignacio Machin ( .NET/ C# MVP )

i wish to store a users custom role in a viewstate...
is this advised?or shall i use profiles?
sorry im a new comer to asp.net so not sure of all the tricks etc.

ViewState only applies for the current page. It's used to stores
values between postback (before you would have to use Hidden Fields).

You could use Session to store data related to the whole session.

there is a asp.net NG, you should check it out.
 
R

rony

ViewState only applies for the current page. It's used to stores
values between postback (before you would have to use Hidden Fields).

You could use Session to store data related to the whole session.

there is a asp.net NG, you should check it out.

you can store data in viewstate if you want to use it again after
postback in one page , if you want to pass data between pages you need
to use Session (iis stores session ids for each browser session).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top