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.
Loading
Sumi DPosted Nov 28, 2011, 12:10 AM
when I browse from there it wont add connection string to webconfig file. it means,
after the configuration from IIS ,when I browse the addconnectionstring page from IIS,and giving the values from there the conncetionstring is adding somewhere but it wont add connectionstring string in webconfig file for that application
can you plz help me.? this is the code.
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";
Please help me.
Suthish NairPosted Nov 26, 2011, 3:05 AM
when I browse from IIs?
Can you explain this line...
Refer
Link1 Link2