In this question I was recommended to set up the web. config from my Cordova project that Ajax uses. I researched the subject but found nothing of the sort. Can anyone help me?
In this question I was recommended to set up the web. config from my Cordova project that Ajax uses. I researched the subject but found nothing of the sort. Can anyone help me?
Set the following to your Web.config
:
<configuration>
...
<appSettings>
...
<add key="BaseURL" value="http://localhost:12345/" />
</appSettings>
</configuration>
Retrieving information:
using System.Configuration;
var baseUrl = ConfigurationManager.AppSettings["BaseURL"];
When deploying, information can be changed through transformation files. In the project, two examples are created: Web.debug.config
and Web.Release.config
. In this case, to change BaseURL
, the setting is as follows for a Web.Release.config
file:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="BaseURL" value="http://urldomeusite.com.br" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>