What is the recommended approach for obtaining the identity of the currently logged in MS Dynamics user from code behind for a custom ASPX page that lives in the ISV directory?
The approach for doing this must be agnostic of whether Dynamics is using AD/NTLM authentication or other authentication mechanisms and must not require enabling impersonation or changing the web.config.
Thanks
You can get the
systemuseridfrom the CRM database by executing a WhoAmIRequest through the CRM web service and then get thesystemuserrecord viacrmservice.Retrieve(). As long as the user has any CRM security roles assigned at all,WhoAmIRequestand read access to their ownsystemuserrecord should always work.