none
Change a conectionstring so it will work with password and IP RRS feed

  • Question

  • Hello,

    in the developing time, I used a local database without password. I imported it in my c# project (edmx) and this created the folowing connectionstring:

    <add name="MasterProductieEntities" connectionString="metadata=&quot;res://*/CCS DataManager.Master.MasterProductieModel.csdl|res://*/CCS DataManager.Master.MasterProductieModel.ssdl|res://*/CCS DataManager.Master.MasterProductieModel.msl&quot;;provider=System.Data.SqlClient;provider connection string=&quot;data source=LT20090522;initial catalog=Productie;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    

    I have gotten the real connectionstring from the remote database administrator, which is:

    Provider=SQLNCLI;Server=10.10.10.8;Database=Productie;User Id=***; Password=xxx;


    What I wonder is, if I change my connectionstring into the following, will it work?

    <add name="MasterProductieEntities" connectionString="metadata=&quot;res://*/CCS DataManager.Master.MasterProductieModel.csdl|res://*/CCS DataManager.Master.MasterProductieModel.ssdl|res://*/CCS DataManager.Master.MasterProductieModel.msl&quot;;provider=System.Data.SqlClient;provider connection string=&quot;data source=10.10.10.8;initial catalog=Productie;Persist Security Info=True;User ID=***;Password=xxx;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    

    Hoping this will work.

    If anyone can confirm, thanks! I just want to be sure so I don't need to stumble on connection problems when deploying.

    Friday, January 27, 2012 3:27 PM

Answers

  • Hi Denny007;

    The connection string you want to use look correct. The only issues is the use of the Persist Security Info = True, see below for Microsoft's recommendation.

    SqlConnection.ConnectionString Property
    Persist Security Info

    When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, January 27, 2012 4:00 PM

All replies

  • Hi Denny007;

    The connection string you want to use look correct. The only issues is the use of the Persist Security Info = True, see below for Microsoft's recommendation.

    SqlConnection.ConnectionString Property
    Persist Security Info

    When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, January 27, 2012 4:00 PM
  • Thanks! I better remove that persistent security info thing then
    Friday, January 27, 2012 5:04 PM