I'm working on a project that will use windows role providers and I want to limit functionality to certain AD groups.
With MVC, I could use an AuthorizeAttribute
above my action methods and redirect accordingly. Is there something similar I can do for a standard web forms application (.NET 3.5) that doesn't use MVC?
I know this is an old post but thought I'd share my experience as I just went through this. I did not want to use web.config. I was looking for a way to create an attribute for webforms similar to MVC's implementation. I found a post by Deran Schilling that I used as a basis for the attribute portion.
I created a custom IPrincipal
and Principal
and created an Attribute for usage on the Page
and created some custom Exceptions
and now I can apply the attribute for usage on a given page
You can set this up in web.config with the authorization element.
Basically domain groups are translated into roles when using
<authentication mode="Windows" />
. You can read more about it on MSDN