To Retrieve Configuration Values from Web.Config in MVC, you should follow the below steps in detail:
1- Open your MVC application and find Web.Config in the root directory of your project.
2- Add a new Key with its value in appSettings section
<add key="NewSetting" value="NewValue" />
3- In the controller, you need to write the following code to retrieve data using the RootURL from the configuration.
string RootURL= System.Configuration.ConfigurationManager.AppSettings["RootURL"];
Most popular tags