Couldnot add connection string to web config file
I am doing a automatic db connection when a setup file is installing in the system.
There checking db connection string in web config file.if no connectionstring the adding connectionstring value to web config file.
using this code,it is working in local system but when I configure in IIS .and I am browsing the aspx page from there ,The connection string is adding somewhere but not in web config file.
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";
it is the code i am using
plz help me