I have EF connection string in my web.config as shown below
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=Source;Initial Catalog=Pricing;Integrated Security=False;UID=User;Pwd=password;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
</connectionStrings>
and in my code I am doing this to get just the connection string which I am using for some other controls
SqlDataSource1.ConnectionString = ((System.Data.Entity.Core.EntityClient.EntityConnection)Entities.Current.Connection).StoreConnection.ConnectionString;
The issue I am facing is that I am getting the connection string but for some reason it does not have the password in it
Data Source=Source;Initial Catalog=Pricing;Integrated Security=False;UID=User;MultipleActiveResultSets=True
and so my connections are failing. Can someone please tell me what I am doing wrong here. I just need the below part
Data Source=Source;Initial Catalog=Pricing;Integrated Security=False;UID=User;Pwd=password;MultipleActiveResultSets=True
Thanks
Edit : So looks like that the password is hidden by design https://social.msdn.microsoft.com/Forums/en-US/5a5730be-c93e-4da5-a614-7ed629f06f51/why-would-password-of-connectionstring-be-filtered-after-instantiating-any-object-in-entity?forum=adodotnetentityframework
Not sure if there is any other way