views:

23

answers:

1

Hi, I have an ASP.NET 3.5 Site where, in some places, I am checking if the currently logged on Active Directory user is in a certain AD Security Group. In the Page_Load I'm doing something like this:

if (isInADGroup(UserGUID))

{ //proceed }

Now I was wondering, couldn't I just create a Custom Attribute, like some of MVC's security attributes, which runs this check and cancels the execution or displays an error message?

A: 

Not sure about an attribute but you could always create a custom page that handles this inheriting from System.Web.UI.Page and use this as the base class for your web forms.

Andy Rose