title: Websphere MQ 7 C# XMS connection using a different user
body: <p>I have been using the XMS API to connect to Websphere MQ and using the following code I am able to connect fine:</p>
  
  <pre><code>    private IConnection CreateWqmConnection() 
      {
          // Create the connection factories factory using WMQ (websphere message queue)
          XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
  
          // Use the connection factories factory to create a connection factory
          IConnectionFactory cf = factoryFactory.CreateConnectionFactory();
  
          // Set the properties
  
          cf.SetStringProperty(XMSC.USERID, @"user");
          cf.SetStringProperty(XMSC.PASSWORD, @"password");
  
          cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, MessageQueueManager);
          cf.SetStringProperty(XMSC.WMQ_HOST_NAME, MessageQueueHost);
          cf.SetIntProperty(XMSC.WMQ_PORT, MessageQueuePort);
          cf.SetStringProperty(XMSC.WMQ_CHANNEL, MessageQueueChannel);
          cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
          cf.SetStringProperty(XMSC.CLIENT_ID, UniqueClientId);
  
          return cf.CreateConnection();            
      }
  </code></pre>
  
  <p>However if I try and change the username and password to anyone other than the user I am currently logged in as I am getting a 2035 security error. I have logged into the host machine and added the user to the mqm group and I can connect using this user from my local machine using WMQ Explorer and publish messages, just not with XMS. </p>
  
  <p>Additionally I have found if I debug the program under this user account I can connect, so it appears I cannot run as one user and authenticate as another. Is this the case with XMS? And is there a way around this?</p>