I am trying to update some configuration settings at run time via my c# code. This is my section of the web.config
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="URL" value="google.com"/>
<add key="Domain" value="d"/>
<add key="Project" value="p"/>
</appSettings>
And this is the code that I am using :
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
System.Configuration.ConfigurationManager.AppSettings.Remove("URL");
System.Configuration.ConfigurationManager.AppSettings.Add("URL","www.stackoverflow.com");
config.Save();
However , it is giving the error that my config file is read-only. I am using Visual Studio 2013. How should I fix this?