欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-08-24 08:48:28
 asp.net创建的线程的用户由 改为nt authoritynetwork service,...
 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