Asp.net的安全认证

来源:互联网 发布:创维42E790U软件 编辑:程序博客网 时间:2024/04/29 10:48

...   

<authentication mode="Forms" >
      <forms name=".ASPXUSER" loginUrl="AdminLogin.aspx" protection="All" timeout="60" />
    </authentication>


 </system.web>
  <location path="Management">
    <system.web>
      <authorization>
       
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

...

在代码中按普通方式,例如要求对方输入信息查找数据库或者XML进行验证,验证通过后,执行这句就表示验证通过同时跳会开始进入的页面
      System.Web.Security.FormsAuthentication.RedirectFromLoginPage(userName,true);
      注销用 System.Web.Security.FormsAuthentication.SignOut();  
      如果不想跳回原处,可以先授权再redirect到其他页面  System.Web.Security.FormsAuthentication.SetAuthCookie();  

原创粉丝点击