Custom roles in ASP.NET

Posted by MainMa on Stack Overflow See other posts from Stack Overflow or by MainMa
Published on 2010-05-01T14:02:43Z Indexed on 2010/05/01 14:07 UTC
Read the original article Hit count: 293

Filed under:
|
|
|
|

Hi,

I am working on an ASP.NET website which uses forms authentication with a custom authentication mechanism (which sets e.Authenticated programmatically on protected void Login_Authenticate(object sender, AuthenticateEventArgs e)).

I have an ASP.NET sitemap. Some elements must be displayed only to logged in users. Others must be displayed only to one, unique user (ie. administrator, identified by a user name which will never change).

What I want to avoid:

  • Set a custom role provider: too much code to write for a such basic thing,
  • Transform the existing code, for example by removing sitemap and replacing it by a code-behind solution.

What I want to do:

  • A pure code-behind solution which will let me assign roles on authenticate event.

Is it possible? How? If not, is there an easy-to-do workaround?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#