Hi,
My web application residing Azure cloud server and database residing into Azure SQL managed instance. They are in the same V Net but under different subnet. i am using sql server authentication to login into instance. in application i defined connection string into web.config file. what i need to do in my web application to get connect with sql managed instance? i am using below code for connection:
private static string GetConnectString()
{
return ConfigurationManager.AppSettings.Get("ConnectString");
}
public static SqlConnection GetConnection(string connectString)
{
SqlConnection connection = new SqlConnection((!string.IsNullOrEmpty(connectString) ? connectString : GetConnectString()));
connection.Open();
return connection;
}
public static SqlConnection GetConnection()
{
SqlConnection connection = new SqlConnection(GetConnectString());
connection.Open();
return connection;
}
Web.Config:
<add key="Connecstring" value="Data Source=prodsqlmi.87f427d03.database.windows.net;Initial Catalog=Test;User ID=Test;Password=*******;"/>
Thanks in advance.