title: Configure SAP .NET Connector for SNC using config file in C#
body: <p>We have a number of applications developed in C# that interface with SAP using the SAP .NET Connector 3.0. I'm very familiar with this, and have recently been asked to look at securing this interface by using the SNC (Secure Network Communications) options, which I've also been able to configure and get working.</p>
  
  <p>However, I want to configure my SNC destinations entirely via config file and not programmatically. To specify an <em>unsecure</em> connection, I can specify the following destination in the config file:</p>
  
  <pre><code>&lt;SAP.Middleware.Connector&gt;
      &lt;ClientSettings&gt;
        &lt;DestinationConfiguration&gt;
          &lt;destinations&gt;          
            &lt;add NAME="MySAPName" USER="MyUser" PASSWD="orly" CLIENT="100" LANG="EN" ASHOST="mysapname.mydomain.com" SYSNR="70" MAX_POOL_SIZE="20" IDLE_TIMEOUT="10"/&gt;          
          &lt;/destinations&gt;
        &lt;/DestinationConfiguration&gt;
      &lt;/ClientSettings&gt;
  &lt;/SAP.Middleware.Connector&gt;
  </code></pre>
  
  <p>But, to create a <em>secure</em> SNC connection, so far I've only figured out how to do it by configuring the destination programatically, e.g.:</p>
  
  <pre><code>  Params.Add(RfcConfigParameters.AppServerHost, "mysapname.mydomain.com");
    Params.Add(RfcConfigParameters.Name, "MySAPName"); 
    Params.Add(RfcConfigParameters.SystemNumber, "70");                                              
    Params.Add(RfcConfigParameters.Language, "EN");
    Params.Add(RfcConfigParameters.Client, "100");
    Params.Add(RfcConfigParameters.User,"MyUser");
    Params.Add(RfcConfigParameters.Password, "orly");                    
  
    // Additional Params for SNC, not settable in config?
    Params.Add(RfcConfigParameters.SncMode, "8");                    
    Params.Add(RfcConfigParameters.SncPartnerName, "p:CN=RemovedForConfidentiality, OU=, O=, L=,C=GB");                                                            
    Params.Add(RfcConfigParameters.SncMyName, "p:CN=MyRemovedPartnerName, C=GB, O=, OU=");
    Params.Add(RfcConfigParameters.SncQOP, "8");
    Params.Add(RfcConfigParameters.Trace, "2");
  </code></pre>
  
  <p>So, given this context my question is: Can I configure an SNC based SAP Destination using only the config file? If so, how?</p>
  
  <p>I realise I could store SncPartnerName etc. in AppSettings but it would be much nicer if it were specifiable in the DestinationConfiguration section. I can't seem to find any documentation on this, however. I should note I'm aware of the the SAP SCN website and have had an unfruitful look on <a href="http://help.sap.com/saphelp_crm700_ehp02/helpdata/EN/5b/617bcd479b46a1829ac0d7886903fb/content.htm" rel="nofollow">there</a>, although I do not have access to the SAP Service Marketplace.</p>