posts - 46,comments - 119,views - 74745
/// <summary>
    /// 给文件夹添加aspnet用户
    /// </summary>
    private void adddirectorysecurity()
    {
        directoryinfo dirinfo = new directoryinfo(server.mappath(strdir));

        if ((dirinfo.attributes & fileattributes.readonly) != 0)
        {
            dirinfo.attributes = fileattributes.normal;
        }

        //取得访问控制列表
        directorysecurity dirsecurity = dirinfo.getaccesscontrol();

        string strdomain = dns.gethostname();

        dirsecurity.addaccessrule(new filesystemaccessrule(strdomain + "\\aspnet", filesystemrights.fullcontrol, accesscontroltype.allow));

        dirinfo.setaccesscontrol(dirsecurity);
    }

posted on   李佩亮  阅读(709)  评论(1编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 开发者新选择:用DeepSeek实现Cursor级智能编程的免费方案
· Tinyfox 发生重大改版
· 独立开发经验谈:如何通过 Docker 让潜在客户快速体验你的系统
· 小米CR6606,CR6608,CR6609 启用SSH和刷入OpenWRT 23.05.5
· 近期最值得关注的AI技术报告与Agent综述!
< 2007年1月 >
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3
4 5 6 7 8 9 10

点击右上角即可分享
微信分享提示