new GenericPrincipal(user.Name, roles);

  • Thread starter Thread starter DotNetNewbie
  • Start date Start date
D

DotNetNewbie

Hi,

When adding roles to the GenericPrincipal, is this a per request
object or is it in session?

In my global.asax.cs , which event should I be adding the roles to the
GenericPrincipal?
 
The roles that you are assigning to the constructor for the
GenericPrincipal instance are valid for the lifetime of the GenericPrincipal
instance.

It all depends on what you are doing with the GenericPrincipal instance
you are constructing, and where you are holding a reference to it. If you
store it in the session, then it will last for the session, if you use it
only during the processing of a page, it will only last for the processing
of the page.

Why are you not using one of the custom membership providers for
ASP.NET? It would probably make what you are doing MUCH easier.
 

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

Back
Top