Monday, July 20, 2020

D365FO | C# | show the current session username

This might be useful when developing something relevant to Web API. Sometimes we might need to know what is the current session running.

This can be done the below C# code.

 string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;  

Result: You can see what the exact current session is running. Something like this. 



Until the next post!


No comments:

Post a Comment