2
Answers

when I browse from IIs not add connection string to webconfig file

Sumi D

Sumi D

12y
2.2k
1
System.Configuration.ConnectionStringSettings connection = new

System.Configuration.ConnectionStringSettings("helloConnectionstring5", constr, "System.Data.SqlClient");
var settings = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(@"/");
settings.ConnectionStrings.ConnectionStrings.Add(connection);
settings.Save();
Global.StartupType = Global.STARTUP_TYPE.NORMAL;
lblstatus.Text = "Connection success and connectionstring updated in webconfig";


this is my code for adding connectionstring in webconfig file.
But this working in my local system.
after configuring IIS.when I browse from there it wont add connection string to webconfig file.

Answers (2)