I have two MVC web applications, a www.company.com and a solution.company.com
The website www.company.com include links to solution.company.com/Contact but how can I set
You can use web.config to set different variables. Use separate web.config for each environment. Eg. web.release and web.debug. Same way you can use. Separate files for each environment
If you use, Octopus deployment. Use can set in octopus variables also.
Now you can easily access this variable and its value from your C# code:
string myVariable = System.Configuration.ConfigurationSettings.AppSettings["MyName"];
Now instead of writing url there, you can use this string instead.
">
If you don't want to use Octopus Deployment, You can follow below steps.
1.) Create new Configuration from Configuration Manager. It is located under Build Menu. and create a new configuration say for eg. Production and select Copy settings from Debug or any other present web.config so you don't have to write again.
2.) After creating a new configuration, Right click on Web.config and click Add Config Transformation after that you will find your new configuration's web.config.
Make the changes in the appSettings section in each of your config and while starting the project, select your build configuration.
It will take the configuration settings from your appSettings section from that respective config.