2
In that question I was recommended to configure the web.config of my project Cordova that uses Ajax. I searched on the subject but found nothing of the kind. Someone can help me?
2
In that question I was recommended to configure the web.config of my project Cordova that uses Ajax. I searched on the subject but found nothing of the kind. Someone can help me?
0
Define in your Web.config
the following:
<configuration>
...
<appSettings>
...
<add key="BaseURL" value="http://localhost:12345/" />
</appSettings>
</configuration>
Retrieving the information:
using System.Configuration;
var baseUrl = ConfigurationManager.AppSettings["BaseURL"];
When deploying, the information can be changed through transformation files. In the project, two are created as an example: Web.debug.config
and Web.Release.config
. In case, to change BaseURL
, configuration is as follows for a file Web.Release.config
:
<?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>
Browser other questions tagged apache-cordova web.config
You are not signed in. Login or sign up in order to post.
Thanks again for the reply @Gypsy, in that comment explain my password better. The project in Ordova can be found here. I didn’t mean well, but these settings should do in my Asp.Net MVC project?
– Jedaias Rodrigues
@Jedaiasrodrigues Yes, exactly. As the configuration is variable, when publishing the project, the
Web.config
will be changed automatically.– Leonel Sanches da Silva
But doesn’t that bring risk to the rest of my project? And in my Cordova project I don’t need to do anything?
– Jedaias Rodrigues
What risks? Could you show me?
– Leonel Sanches da Silva
Well what basically makes this change?
– Jedaias Rodrigues
As I told you, the configuration makes it possible for you to use variable values for configuration of, for example, the base URL of your application. When sending to production, it is obvious that an address based on
localhost
won’t work.– Leonel Sanches da Silva
Friend, suppose I have a . html file that I just created in the notepad with an Ajax code to get the data generated by this application. I put a breakpoint in the application and the request is coming normally, but after that the Ajax error message is generated, what could it be? You would have an example to get the data from the cited link?
– Jedaias Rodrigues
Please ask another question.
– Leonel Sanches da Silva
The new question was asked at this link.
– Jedaias Rodrigues