首页 > ASP.Net > 综合技巧 > 正文
ASP.NET创建的线程的用户改变引发的\拒绝访问\错误解决方法
来源:-  时间:2007-11-05  作者:-  点击次数:126

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