Re: How can I get current role name???

From: Wes Henderson (wes1024_at_hotmail.com.nospam)
Date: 03/22/04


Date: Mon, 22 Mar 2004 13:14:10 -0600

I *think* you can tell what role the user currently has with
User.IsInRole("")

so something like

private String enumUserRoles()
{
    String strReturn = "";

    if (User.IsInRole("vip")) strReturn = "vip";
    if (User.IsInRole("mov") && strReturn == "") strReturn = "mov";
    else if (User.IsInRole("mov") && strReturn != "") strReturn += ", mov";

    return strReturn;
}

the else statement is in case the user somehow has both roles.

-- 
Regards,
Wes Henderson,
MCSE: Security
In order to help everyone, please direct all replies to this newsgroup.
This posting is my personal effort to provide help and is not on behalf of
any company.
Also, this posting is provided "AS IS" with no expressed or implied
warranties.
"冷自泉" <brhhk@swnu.edu.cn> wrote in message
news:eR1%23PvhDEHA.580@TK2MSFTNGP11.phx.gbl...
> I design my project base on roles FormsAuthentication.
> with following config:
>
> <location path="other">
>         <system.web>
>             <authorization>
>                 <allow roles="vip"/>
>                 <allow roles="mov"/>
>                 <deny users="*" />
>             </authorization>
>         </system.web>
> </location>
>
> I want to konw how can i get the name of role in other page.
> How can i judge which role the current user is?
> Can i judge it from cookie?And how?
> Thankes very much!!!
>
>
>
>
>
>


Relevant Pages

  • Re: Brinks v Jim Rojas New Motion
    ... Wonder if they know what/who Nomen Nescio even is - actually they should ... | quoted back to the judge in an attempt to make you look bad. ... The money you spend on lawyers ... | multiple Nomen Nescios posting messages here. ...
    (alt.security.alarms)
  • Re: I love Conservatives...no really.....
    ... > Speaking of blogging and posting, JTodd - your thoughts on LGF's ... If only B. Hussein had any kind of legislative record to judge him by... ... "A vote for Obama is a vote for 'Present'!" ...
    (rec.sport.pro-wrestling)
  • Re: attn: Mr. Riprock & Dr. Hermes
    ... posting a funny or informative or interesting excerpt so we can judge ...
    (rec.arts.comics.marvel.universe)
  • Re: I love Conservatives...no really.....
    ... > Speaking of blogging and posting, JTodd - your thoughts on LGF's ... If only B. Hussein had any kind of legislative record to judge him by... ... "A vote for Obama is a vote for 'Present'!" ...
    (rec.sport.pro-wrestling)