最近做了一个销售系统,公司人员分了级别,如:0-老板,1-项目经理,2-职员
user表结构:id username password userrole
为了好控制各个级别的权限,我把老板的特有权限页面放到了文件夹“laoban”中;项目经理的放到“jinli”中,其余的在根目录下
这样,我通过laoban文件下的web.config设置如下:
<configuration>
<system.web>
<authorization>
<allow roles="laoban" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
根目录的web.config设置如下:
<authentication mode="Forms">
<forms loginUrl="login.aspx" name = ".ASPXFORMSAUTH" protection="All" timeout="20"/>
</authentication> 可是我现在,为何用老板的帐号进不了laoban文件夹呢?我在根目录对该帐号也进行了角色验证System.Web.HttpContext.Current.User.IsInRole("laoban")返回的值为true啊,疑惑啊
user表结构:id username password userrole
为了好控制各个级别的权限,我把老板的特有权限页面放到了文件夹“laoban”中;项目经理的放到“jinli”中,其余的在根目录下
这样,我通过laoban文件下的web.config设置如下:
<configuration>
<system.web>
<authorization>
<allow roles="laoban" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
根目录的web.config设置如下:
<authentication mode="Forms">
<forms loginUrl="login.aspx" name = ".ASPXFORMSAUTH" protection="All" timeout="20"/>
</authentication> 可是我现在,为何用老板的帐号进不了laoban文件夹呢?我在根目录对该帐号也进行了角色验证System.Web.HttpContext.Current.User.IsInRole("laoban")返回的值为true啊,疑惑啊
{
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.Txt_UserName.Text,false);
}
你将这里的laoban改为你老板的账号试一下 "域名/老板的账号"
看是不是角色的问题