zoukankan      html  css  js  c++  java
  • 配置 authorization deny allow

    http://blog.csdn.net/wwlearn/article/details/5457310

    <authorization>
        <deny users = "?"/>
        <allow users= "*" />
    </authorization>

     

    ?:匿名用户,也就是没有登入的用户不能访问。
    *:所有用户,所有用户都不能访问。

     

    <deny users = "?"/>、 是拒绝匿名用户访问
    <allow users= "*" /> 允许所有的用户访问包括匿名用户

     

    <authentication mode="Forms">
         <forms name=".ASPXAUTH" loginUrl="~/login.aspx"></forms>
           <!-- 默认cookie 名 及登陆页面地址  -->
       </authentication>
       <authorization>
         <deny users="?"></deny> <!-- 禁止匿名访问  -->
       </authorization>

     

    <location path="Default.aspx"><!--允许所有人访问这个页面-->
        <system.web>
          <authorization>
            <allow users="*"/>
          </authorization>
        </system.web>
      </location>

    // 自定义票据,获取用户的roles,写到票据中。票据会携带在cookie中。
               FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                   1,                                         // version
                   loginID,                               // user name
                   DateTime.Now,                              // creation
                   DateTime.Now.AddMinutes(60 * 20),               // Expiration
                   false,                                     // Persistent
                   "");                              // userData

               String encryptedTicket = FormsAuthentication.Encrypt(authTicket);
               HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
               Response.Cookies.Add(authCookie);
  • 相关阅读:
    mysql无法启动的结果问题解决
    pm2日志管理插件
    运维常用shell脚本之日志清理
    Centos7.x for aarch64 下载地址
    linux下使用openssl生成https的crt和key证书
    rsync+inotify百万级文件实时同步
    nginx访问url内容过滤
    docker-compose部署zabbix4.2.5
    postgresql从库提升为主库
    Nginx+keepalived 高可用双机热备(主从模式)
  • 原文地址:https://www.cnblogs.com/shiningrise/p/2951784.html
Copyright © 2011-2022 走看看