2010-06-22 5 views
0

J'ai un code personnalisé à l'intérieur d'un rapport SSRS qui doit obtenir l'utilisateur actuel. par exemple.SSRS WindowsIdentity.GetCurrent() me donnant un SERVICE NT AUTHORITY NETWORK

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

Je me serais attendu à GetCurrent() pour retourner le principal de l'utilisateur qui a accédé au rapport; cependant, il me donne le principal de "NT AUTHORITY \ NETWORK SERVICE". Est-ce que quelqu'un sait comment exécuter ReportServer en tant qu'utilisateur exécutant le rapport? J'ai vérifié les deux web.config, et ils indiquent tous les deux Windows Authentication et Impersonate = True.

Répondre

2

Ok, je l'ai compris. Je viens d'utiliser

System.Threading.Thread.CurrentPrincipal.Identity 

au lieu de

WindowsIdentity.GetCurrent() 

Cela ne fonctionne pas quand je suis aperçu de l'état local à savoir

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

mais il fonctionne très bien après que je déploie un serveur.