Re: How can I get current role name???
From: 冷自泉 (brhhk_at_swnu.edu.cn)
Date: 03/23/04
- Next message: Micha艂 Januszczyk: "RedirectFromLoginPage, but somewhere else"
- Previous message: 冷自泉: "but"
- In reply to: Wes Henderson: "Re: How can I get current role name???"
- Next in thread: Ravichandran J.V.: "Re: How can I get current role name???"
- Reply: Ravichandran J.V.: "Re: How can I get current role name???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 23 Mar 2004 18:18:02 +0800
Thanks for your answer!
But i have another question.
Tow types roles is an simple example.
If i have 1000 roles,and i want to display his role name in my page.How
to???
like:
You are vip user
or
You are mov user
or
You are xxx user
...
...
...
Can i do like this?
if (User.IsInRole("vip")) strReturn = "vip";
if (User.IsInRole("mov") && strReturn == "") strReturn = "mov";
else if (User.IsInRole("mov") && strReturn != "") strReturn += ", mov";
...
...
...
...
Is there some simple way?
Is there have some methord like "roles.Name" or other
that i can do like this:
Response.Write("You are "+roles.Name+" user!!!");
"Wes Henderson" <wes1024@hotmail.com.nospam> 写入消息
news:u3$wcHEEEHA.3804@TK2MSFTNGP09.phx.gbl...
> 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!!!
> >
> >
> >
> >
> >
> >
>
>
- Next message: Micha艂 Januszczyk: "RedirectFromLoginPage, but somewhere else"
- Previous message: 冷自泉: "but"
- In reply to: Wes Henderson: "Re: How can I get current role name???"
- Next in thread: Ravichandran J.V.: "Re: How can I get current role name???"
- Reply: Ravichandran J.V.: "Re: How can I get current role name???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]