TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

Setting and Using application variables in .NET MVC

April 29, 2019

  • 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
code
<configuration>
  <appSettings>
	  <add key="PayPalReturnUrl" value="http://blah.com/subscribe/paypal-response" />
  </appSettings>
</configuration>
code
@using System.Configuration

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