using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using
using System.Security.AccessControl;
using
public partial class floder : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
bool isOK = true;
string path = this.MapPath("article/"+"cccc");
if (!Directory.Exists(path))
{
string strDomain = Dns.GetHostName();
Directory.CreateDirectory((path));
// addpathPower(path,"FullControl");
//AddDirectorySecurity(path);
DirectoryInfo dir = new DirectoryInfo(path);
DirectorySecurity security = dir.GetAccessControl();
FileSystemAccessRule accessRule = new FileSystemAccessRule(strDomain + "\\ASPNET", FileSystemRights.Modify, (InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit), PropagationFlags.None, AccessControlType.Allow);
security.ModifyAccessRule(AccessControlModification.Add, accessRule, out isOK);
dir.SetAccessControl(security);
}
}
}
这个是我做的测试页面!