Is there a way to get the username of the Windows account of the client accessing the ssrs report. If a user accesses reports on server B from machine A, how can we get the Windows username in the SSRS report?
I used User! UserID, and it worked fine since I ran it from my local machine. As soon as it has been deployed to another server, it stops working because it is a valid user! UserID is not available.
Pls. suggest.
My bad. I get the username. But it seems that the "code" that I need to execute on the server did not work. I added vb.net code in the "Report Properties → Code" section. It works fine on the local machine. I just right-clicked and deployed the report to the server. Is there any additional step that needs to be performed for the "Code", which will be deployed to the server, and will also be performed. Its a very simple vb.net function as shown below
Public Shared Function GetUserName(ByVal input as String) As String
Try
input = input.Replace("<domain>\", "")
Dim details(2) As String
details = input.Split(".".ToCharArray())
input = String.Concat(details(1), ", ", details(0))
Catch ex As Exception
Return ex.Message
End Try
Return input
End Function
Update: For
some reason, input = input.Replace ("\", "") doesn't seem to work. The rest of the code seems to work. Thus, the code is definitely deployed along with the report. It is vague why input.Replace () works on the local computer and not on the server.
Update:
, , , , , Replace . ToLower() , . . .
, , Windows ssrs.