I need to connect to my Dynamics CRM 365 on premise instance from an ASP NET application. My problem is that the account for connection has a password like: T,jL4O&vc%t;30
<connectionStrings>
<add name="CRM365" connectionString="AuthType=AD;Url=http://crm.xxx.com/CRM365; Domain=test; Username=test; Password=T,jL4O&vc%t;30" />
</connectionStrings>
I have the following error: vc is not defined
Please help. Thanks
In this example I see two things:
&
in xml should be escaped with &
(Good explanation in this answer);
in a connection string, you should wrap the password in single quotesSo this should work for you:
<connectionStrings>
<add name="CRM365" connectionString="AuthType=AD;Url=http://crm.xxx.com/CRM365; Domain=test; Username=test; Password='T,jL4O&vc%t;30'" />
</connectionStrings>
Edit (just tried it for myself):
Additionally, another variant is to use escaped double quotes:
<connectionStrings>
<add name="CRM365" connectionString="AuthType=AD;Url=http://crm.xxx.com/CRM365; Domain=test; Username=test; Password="T,jL4O&vc%t;30"" />
</connectionStrings>
Summary:
Use either password='T,jL4O&vc%t;30';
or password="T,jL4O&vc%t;30";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With