zoukankan
html css js c++ java
C#创建文件夹并设置权限
/*
需要添加以下命名空间:
using System.IO;
using System.Security.AccessControl;
*/
string
sPath
=
Server.MapPath(文件夹名称字符串);
Directory.CreateDirectory(sPath);
addpathPower(sPath,
"
ASPNET
"
,
"
FullControl
"
);
////////////////////////////////////////////////
//
public
void
addpathPower(
string
pathname,
string
username,
string
power)
{
DirectoryInfo dirinfo
=
new
DirectoryInfo(pathname);
if
((dirinfo.Attributes
&
FileAttributes.ReadOnly)
!=
0
)
{
dirinfo.Attributes
=
FileAttributes.Normal;
}
//
取得访问控制列表
DirectorySecurity dirsecurity
=
dirinfo.GetAccessControl();
switch
(power)
{
case
"
FullControl
"
:
dirsecurity.AddAccessRule(
new
FileSystemAccessRule(username, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
break
;
case
"
ReadOnly
"
:
dirsecurity.AddAccessRule(
new
FileSystemAccessRule(username, FileSystemRights.Read, AccessControlType.Allow));
break
;
case
"
Write
"
:
dirsecurity.AddAccessRule(
new
FileSystemAccessRule(username, FileSystemRights.Write, AccessControlType.Allow));
break
;
case
"
Modify
"
:
dirsecurity.AddAccessRule(
new
FileSystemAccessRule(username, FileSystemRights.Modify, AccessControlType.Allow));
break
;
}
dirinfo.SetAccessControl(dirsecurity);
}
查看全文
相关阅读:
cf B. Sonya and Exhibition
cf B. Sonya and Exhibition
1000C
1000C
AOE网打印所有的关键路径
AOE网打印所有的关键路径
拓扑排序判断有向图是否成环
拓扑排序判断有向图是否成环
迭代器
Dictionary Aizu
原文地址:https://www.cnblogs.com/top5/p/1710141.html
最新文章
http协议
用 Eclipse 部署tomcat服务器
hive中的更新或者新建表impala 不能实时更新
Spark-Hive中出现 access denied org.apache.derby.security.SystemPermission( "engine", "usederbyinternals" )问题
sqoop数据导入hive 遇到的问题
jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.net.URLClassLoader
报错:The processing instruction target matching "[xX][mM][lL]" is not allowed.
sqoop本地调用远程的hive和远程mysql(重点)
hive 安装警告 WARN conf.HiveConf: HiveConf of name hive.metastore.local does not exist
Sqoop 1.4.7 Java 开发
热门文章
大数据开发之Sqoop篇----sqoop export
红外遥控码
手册感悟
Altium Designer四层板起步
Altium Designer一些问题
Altium Designer中距离的测量
Altium Designer规则的制定,一般规则
【二分】——COCI2008 猴子摘桃
cf Sonya and Robots
cf Sonya and Robots
Copyright © 2011-2022 走看看