Correct Answer : In Web.config file.
Explanation :
Following are the steps to create the connection string in Web.config file and access it in code behind file. In connection string data source and database name you have to provide according to your sqlserver instance and their database name.
Step 1 : Create the connection string in Web.config file as follows.
< connectionStrings>
< add name="con" connectionString="Data Source =ServerName; initial catalog= DataBaseName; Integrated Security=true"/>
Step 2 : In code behind file write the following code.
ConfigurationManager class is available in System.Configuration namespace;
string conStr= ConfigurationManager.ConnectionStrings["con"].ConnectionString;
SqlConnection conObj = new SqlConnection(conStr);
conObj.Open();
// Write code according to the requirement.
conObj.Close();