public void LogonAs(
When using the logon as method of the Business Connector .NET you face a lot off issues. After searching on the net I found that almost everyone forces the bcProxyCredentials but actually this not the way it is supposed to be used.
but here the MSDN documentation contains an error:
Credentials of the Business Connector Proxy user used to authenticate and enable the use of LogonAs.
You can create a NetworkCredential object with the following code:
System.Net.NetworkCredential creds = new System.Net.NetworkCredential(
ADUserName, ADUserPassword, ADDomain)The NetworkCredential parameters must match the Business Connector Proxy user set in the Business Connector Proxy dialog box: To verify your settings go to the Administration pane, click Setup, click Security, and then select BusinessConnectorProxy.
the part in bold is wrong. If you open the client application got the Administration pane > Security > System Service Accounts and there you can set the Business Connector Proxy accound and you can perform the LogonAs method to imperonate another user.
From the installation guide:
Some components require that the .NET Business Connector be configured to connect to Microsoft Dynamics AX with a proxy account. The use of a proxy enables the .NET Business Connector to connect on behalf of Microsoft Dynamics AX users when authenticating with an AOS instance.
Next you should be able to use the LogonAs method to logon as any valid Axapta user
Edit: if you want to use the user that is running the process as the proxy account pass null to the LogonAs method for the bcProxyCredentials parameter