SSRS WindowsIdentity.GetCurrent () gives me NT AUTHORITY \ NETWORK SERVICE

I have my own code inside the SSRS report that the current user should receive. eg.

Dim myPrincipal As New System.Security.Principal.WindowsPrincipal   
   (System.Security.Principal.WindowsIdentity.GetCurrent())

I would expect GetCurrent () to return to the principal the user who accessed the report; however, he gives me the main post "NT AUTHORITY \ NETWORK SERVICE". Does anyone know how to get ReportServer to run as the user running the report? I checked both web.config and both of them indicate Windows Authentication and Impersonate = True.

0
source share
1 answer

Ok, I figured it out. I just used

System.Threading.Thread.CurrentPrincipal.Identity 

instead

WindowsIdentity.GetCurrent()

This does not work when I view the report locally ie

Thread.CurrentPrincipal.Identity.Name //returns an empty string when previewing locally

but it works fine after deploying to the server.

+2

Source: https://habr.com/ru/post/1699212/


All Articles