4
我在IIS中的应用程序中使用模拟。我需要将文件写入文件系统,但不希望在这种情况下使用模拟用户的凭据。我需要使用应用程序池的凭据。将模拟的凭据提升到IIS中的应用程序池凭证
如何暂时将工作进程的凭证从模拟凭证提升到应用池的凭证?
我在IIS中的应用程序中使用模拟。我需要将文件写入文件系统,但不希望在这种情况下使用模拟用户的凭据。我需要使用应用程序池的凭据。将模拟的凭据提升到IIS中的应用程序池凭证
如何暂时将工作进程的凭证从模拟凭证提升到应用池的凭证?
在谷歌搜索之后找到了答案。
using System.Security.Principal;
WindowsImpersonationContext ctx =
WindowsIdentity.Impersonate(System.IntPtr.Zero);
//do stuff in app pool's security context
ctx.Undo();
http://www.mindsharpblogs.com/todd/archive/2005/05/03/467.aspx
可以请你添加的东西相关的应用程序池的安全上下文 – 2014-12-23 13:06:07