当前位置:编程学习 > C#/ASP.NET >>

DirectoryInfo.GetAcessControl访问权限问题

通过dInfo=DirectoryInfo(filepath)获取文件夹的访问权限,
DirectorySecurity dSecurity = dInfo.GetAccessControl(System.Security.AccessControl.AccessControlSections.All);
System.Security.Principal.IdentityReference identityReference;
identityReference = dSecurity.GetGroup(typeof(System.Security.Principal.NTAccount));

本地运行没有问题的,但是部署到IIS上面,别的机器通过web访问的时候,就出现了错误:


[PrivilegeNotHeldException: 该进程不具有执行此操作所需的“SeSecurityPrivilege”特权。]
   System.Security.AccessControl.Win32.GetSecurityInfo(ResourceType resourceType, String name, SafeHandle handle, AccessControlSections accessControlSections, RawSecurityDescriptor& resultSd) +697
   System.Security.AccessControl.NativeObjectSecurity.CreateInternal(ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext) +63
   System.Security.AccessControl.FileSystemSecurity..ctor(Boolean isContainer, String name, AccessControlSections includeSections, Boolean isDirectory) +86
   System.Security.AccessControl.DirectorySecurity..ctor(String name, AccessControlSections includeSections) +45
   System.IO.DirectoryInfo.GetAccessControl(AccessControlSections includeSections) +29
   DocmManagem.DocuMN.Databind(String pathurl) in C:\Inetpub\wwwroot\123\DocmManagem\DocmManagem\DocuMN.aspx.cs:404
   DocmManagem.DocuMN.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\123\DocmManagem\DocmManagem\DocuMN.aspx.cs:99
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


真心希望各位朋友能够指点迷津。帮小弟一个忙,非常感谢! --------------------编程问答-------------------- 不是太懂  给你顶一下 --------------------编程问答-------------------- 爱在夕阳下 
   回复于: 2013-05-10 14:17:52 
   不是太懂  给你顶一下


哈哈,你是我发了贴第一个回复的,还是要感谢。呵呵,我已经解决了,配置了以下IIS身份验证就好了! 
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,