1

Is is possible to add or change connection in the connection string in the App.config, programmatically? I've tried something with

    var A = ConfigurationManager.ConnectionStrings;
    A.Add(new ConnectionStringSettings());

but i got a message that it's read only.

Please help

1 Answer 1

1

Any modification to the configuration file of a web application requires IIS to restart. As such, you cannot make a runtime modification to the file from your code because it would require restarting the entire application.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this is simply because of how IIS manages configuration values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.