当前位置:编程学习 > asp >>

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

 ASP.NET创建的线程的用户由<identity impersonate="true"/> 改为NT AUTHORITYNETWORK 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


补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,