You could use either of the following methods, where you have any control
named c:
c.Visible = User.Identity.Name = "AllowedUserName"
- or -
c.Visible = User.IsInRole("MyAllowRole")
You could then combine this with a user control, or a panel to make a whole
block of the page show/hide, instead of just one control.
HTH.
"Jerod Guida" <> wrote in message
news:%...
>I am fairly new to asp.net and am using webforms in vb.net. I have read a
> lot about authorization to entire pages using role-based security, but I
> haven't seen much in regard to role-based security for controls within a
> page.
>
> For example, say that I want an aspx page to show a link for "Maintenance"
> when the user "John" is logged in but not for anyone else. All users have
> authorization to see the aspx page (set in web.config), but how does
> someone
> go about the process of conditionally displaying the link? My question is
> generic in that I don't specifically care about the link, rather, I am
> looking for something that could be applied to any type of control
> (textboxes, buttons, etc) within webforms.
>
> Thanks in advance,
> Jerod
>
>
|