打印本文 打印本文 关闭窗口 关闭窗口
解决ASP.NET创建的线程的用户改变引发的拒绝访问错误
作者:武汉SEO闵涛  文章来源:敏韬网  点击数763  更新时间:2009/4/23 10:43:12  文章录入:mintao  责任编辑:mintao

解决ASP.NET创建的线程的用户改变引发的"拒绝访问"错误
      

         ASP.NET创建的线程的用户由<identity impersonate="true"/> 改为NT AUTHORITY\NETWORK SERVICE, 引起"System.UnauthorizedAccessException","拒绝访问"

    Dim thr As Threading.Thread
    Dim l As System.Security.Principal.WindowsIdentity

    Function print()
        thr = New Threading.Thread(AddressOf printAutoCAD)
        thr.Start()
        l = System.Security.Principal.WindowsIdentity.GetCurrent
    End Function

    Private Sub printAutoCAD()
        System.Security.Principal.WindowsIdentity.Impersonate(l.Token)
 ...
    End Function

打印本文 打印本文 关闭窗口 关闭窗口