Consider the need $.post()for a slightly different URL structure in the Visual Studio Dev environment and in the IIS deployment or testing environment.
When deployed to a test server, the application runs under a virtual directory in IIS. The URL will look something like this:
Deployed
URL: http://myServer/myApplication/Area/Controller/Action
Using jQuery .post(), I need to specify a line:
$.post( "/myApplication/myArea/myController/myMethod"
Development
In Visual Studio
Cassini URL: http://localhost:123/Area/Controller/Action
Using jQuery .post(), I need to specify a line:
$.post( "/myArea/myController/myMethod"
Question:
How can I get both of them to use the same line of code, regardless of their deployed environment?
source
share