Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

C# - Problem in connect to crm with password wich has a ";"

Posted on by 55

Hello to all!
Can anyone help me?

Im trying to connect to CRM with following code:

Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(connectionString);

service = new OrganizationService(connection); 

My connection string 

string connectionString = "Url=<myOrg>; Username=<myLogin>; Password=<MyPass>";

So, problem is - my password has a ';' symbol, so 

CrmConnection.Parse 
method can't to parse it right and throw an error.

How can I avoid this problem, or how I can connect to CRM with another method?

This method 

IOrganizationService _service = null;
                OrganizationServiceProxy _serviceProxy = null;
                IServiceConfiguration<IOrganizationService> orgConfigInfo =
                    ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("https://<myOrg>/XRMServices/2011/Organization.svc"));
                var creds = new ClientCredentials();
                creds.Windows.ClientCredential = new System.Net.NetworkCredential(connectionString.Username, connectionString.Password);
                using (_serviceProxy = new OrganizationServiceProxy(orgConfigInfo, creds))
                {
                    return (IOrganizationService)_serviceProxy;
                   
                }


throw an error:  The authentication endpoint Kerberos was not found on the configured Secure Token Service!

*This post is locked for comments

  • Verified answer
    RE: C# - Problem in connect to crm with password wich has a ";"

    Works with following method:

    ClientCredentials Credentials = new ClientCredentials();
                    Credentials.UserName.UserName = UserName;
                    Credentials.UserName.Password = Password;
                    Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
                    Uri OrganizationUri = new Uri("https://<myOrg>/XRMServices/2011/Organization.svc");
                    OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, null, Credentials, null);
                    return (IOrganizationService)serviceProxy;


    Problem solved. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans