locked
Azure db connection string into webconfig RRS feed

  • Question

  • User-1852975005 posted

    Hi,
    first question, I feel dumb asking. Some times I have to put the connection string into appsettings and other times in webconfig.
    Is this because the first is core and the second is .netframe work or some other reason.

    The second question is how do I place the connection string from Azure (looks copletey different) into the web config.
    Example below;

    I dont have an example of a connection string from Azure at the moment.

    However from the webconfig as below;

    <connectionStrings>
       
    <add name="SchoolContext" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=ContosoUniversity1;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    Thanks,

    Wednesday, March 25, 2020 9:51 AM

All replies

  • User475983607 posted

    first question, I feel dumb asking. Some times I have to put the connection string into appsettings and other times in webconfig.
    Is this because the first is core and the second is .netframe work or some other reason.

    ASP.NET Core uses appseting.json.   ASP.NET uses the web.config.

    The second question is how do I place the connection string from Azure (looks copletey different) into the web config.
    Example below;

    Azure connection strings are covered here; https://www.connectionstrings.com/azure-sql-database/

    The connection string goes in the same web.config location as your same with the same format; a Name and the connection string.  

    Wednesday, March 25, 2020 11:23 AM