【问题标题】:Elevate impersonated credentials to app pool credentials in IIS将模拟凭据提升为 IIS 中的应用程序池凭据
【发布时间】:2010-10-09 19:58:44
【问题描述】:

我在 IIS 的应用程序中使用模拟。我需要将文件写入文件系统,但在这种情况下不想使用模拟用户的凭据。我需要使用应用程序池的凭据。

如何临时将工作进程的凭据从模拟凭据提升到应用程序池的凭据?

【问题讨论】:

    标签: iis impersonation credentials


    【解决方案1】:

    经过多次谷歌搜索找到了答案。

    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

    【讨论】:

    • 能否请您添加与应用程序池的安全上下文相关的内容
    猜你喜欢
    • 2018-06-19
    • 2020-06-25
    • 2016-02-12
    • 1970-01-01
    • 1970-01-01
    • 2020-05-27
    • 2010-11-23
    • 2015-05-03
    • 1970-01-01
    相关资源
    最近更新 更多