Setting and Using application variables in .NET MVC

  • You do that in Web.config
  • You can have multiple config files for differnt setups, for example: Web.alpha.config, Web.beta.config, Web.Release.config and Web.config
<configuration>
  <appSettings>
	  <add key="PayPalReturnUrl" value="http://blah.com/subscribe/paypal-response" />
  </appSettings>
</configuration>
@using System.Configuration

private static readonly string C_REDIRECT_URL = ConfigurationManager.AppSettings["PayPalReturnUrl"];