【发布时间】:2009-11-30 13:34:18
【问题描述】:
在我的 web.config 我有这个:
<system.web>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" protection="All" path="/" timeout="30"/>
</authentication>
<sessionState timeout="20" />
</system.web>
<location path="admin">
<system.web>
<authorization>
<deny users="*"/>
<allow users="admin"/>
</authorization>
</system.web>
</location>
我有两个问题:
在我的管理员路径中,我只希望管理员用户具有访问权限,但我找不到执行此操作的方法。如何让只有管理员用户才能访问?
-
即使我尝试使用 cookie,用户也总是会被注销,因此他不应该被注销。在我的 login.aspx 中,当用户有效时,我有以下代码:
FormsAuthentication.RedirectFromLoginPage(user, CheckBoxPersistCookie.Checked);
如何让用户保持登录状态?
【问题讨论】:
标签: asp.net authentication forms-authentication