111,126
社区成员
发帖
与我相关
我的任务
分享
web.config中加
<system.web>
<identity impersonate="true" />//web.config必须加的不然会报错主要用途是虚拟特定的用户
<system.web \>
//引用命名空间,这个需要引用一个外部的程序集有需要的可以联系我QQ:444511958
using Microsoft.Win32.Security;
SecurityDescriptor secDesc = SecurityDescriptor.GetFileSecurity(Server.MapPath(@"../../App_Data"), SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
Dacl dacl = secDesc.Dacl;
//windows xp sid用ASPNET windows 2003 sid用NETWORK SERVICE
dacl.AddAce(new AceAccessAllowed(new Sid("ASPNET"), AccessType.GENERIC_ALL, AceFlags.CONTAINER_INHERIT_ACE | AceFlags.OBJECT_INHERIT_ACE));
secDesc.SetDacl(dacl);
secDesc.Owner = new Sid("ASPNET");
secDesc.SetFileSecurity(Server.MapPath(@"../../App_Data"), SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);