private void specificUserLogon(bool guiMode, contentManagerService1 cCMS, string userName, string userPassword, string userNamespace) { // sn_dg_prm_sdk_method_contentManagerService_logon_start_0 System.Text.StringBuilder credentialXML = new System.Text.StringBuilder("<credential>"); credentialXML.AppendFormat("<namespace>{0}</namespace>", userNamespace); credentialXML.AppendFormat("<username>{0}</username>", userName); credentialXML.AppendFormat("<password>{0}</password>", userPassword); credentialXML.Append("</credential>"); //The csharp toolkit encodes the credentials string encodedCredentials = credentialXML.ToString(); xmlEncodedXML xmlEncodedCredentials = new xmlEncodedXML(); xmlEncodedCredentials.Value = encodedCredentials; searchPathSingleObject[] emptyRoleSearchPathList = new searchPathSingleObject[0]; cCMS.logon(xmlEncodedCredentials, null); // sn_dg_prm_sdk_method_contentManagerService_logon_end_0 }
public void UserLogon(string userName, string userPassword, string userNamespace, contentManagerService1 cmService) { try { System.Text.StringBuilder credentialXML = new System.Text.StringBuilder("<credential>" ); credentialXML.AppendFormat( "<namespace>{0}</namespace>", userNamespace ); credentialXML.AppendFormat( "<username>{0}</username>", userName ); credentialXML.AppendFormat( "<password>{0}</password>", userPassword ); credentialXML.Append( "</credential>" ); //The csharp toolkit encodes the credentials string encodedCredentials = credentialXML.ToString (); xmlEncodedXML xmlEncodedCredentials = new xmlEncodedXML(); xmlEncodedCredentials.Value = encodedCredentials; searchPathSingleObject[] emptyRoleSearchPathList = new searchPathSingleObject[0]; cmService.logon(xmlEncodedCredentials, null); } catch (System.Exception ex) { Console.Write(ex.Message); } }