Re: How can I get current role name???
From: Wes Henderson (wes1024_at_hotmail.com.nospam)
Date: 03/22/04
- Next message: richlm: "Re: ASPNET-IIS directories permissions"
- Previous message: Jim Cheshire [MSFT]: "RE: Connect to SQL Server database results in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
- In reply to: 冷自泉: "How can I get current role name???"
- Next in thread: 冷自泉: "Re: How can I get current role name???"
- Reply: 冷自泉: "Re: How can I get current role name???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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!!! > > > > > >
- Next message: richlm: "Re: ASPNET-IIS directories permissions"
- Previous message: Jim Cheshire [MSFT]: "RE: Connect to SQL Server database results in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
- In reply to: 冷自泉: "How can I get current role name???"
- Next in thread: 冷自泉: "Re: How can I get current role name???"
- Reply: 冷自泉: "Re: How can I get current role name???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|