Asp.net 在不同页面上使用RedirectFromLoginPage
Im使用登录名和数据库检查用户是否在那里,然后将用户发送到我锁定的页面。 它工作得很好,但只能从Default.aspx开始,但是用户可以点击其他页面,但是表单在用户登录之前一直在我的所有页面上 如何将其更改为在我的所有页面上工作,包括用户想要注销时:Asp.net 在不同页面上使用RedirectFromLoginPage,asp.net,Asp.net,Im使用登录名和数据库检查用户是否在那里,然后将用户发送到我锁定的页面。 它工作得很好,但只能从Default.aspx开始,但是用户可以点击其他页面,但是表单在用户登录之前一直在我的所有页面上 如何将其更改为在我的所有页面上工作,包括用户想要注销时: <authentication mode="Forms"> <forms loginUrl="Default.aspx" defaultUrl="inloggad/rosta.aspx">
<authentication mode="Forms">
<forms loginUrl="Default.aspx" defaultUrl="inloggad/rosta.aspx">
<credentials passwordFormat="Clear">
</credentials>
</forms>
</authentication>
您必须创建客户、管理员等角色,然后在web.config中添加以下内容
<location path="/">
<system.web>
<authorization>
<allow roles="Administrators" />
<allow roles="customers" />
<deny users="*" />
</authorization>
</system.web>
</location>