开发者

Custom Attribute in ASP.NET for Page_Load

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 s开发者_运维知识库ecurity attributes, which runs this check and cancels the execution or displays an error message?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜