I have the same problem described here: Javascript in Virtual Directory unaware of Virtual Directory
But the proposed solutions of using a hidden field or a server-side generated json settings object don't work for me, since the server-side doesn't actually know it's own url. If I do Url.Content("~") I just get an ip of one of the machines the code runs on so I can never use that path in javascript. It also returns a http url instead of the outside https url.
So to be more precise: https://myhost.com/myapp/ /* here's where my code runs */
I could use relative paths in jquery (like this: $.get('api/controller')) but the application does not work if the user uses 'https://myhost.com/myapp' (so no trailing slash). (well actually the page gets loaded but the call-backs fail because of the lack of trailing slash)
I could use absolute urls but the server-side code does not know the actual url...
Is there any way to have javascript return the full absolute path WITH virtual directory WITH trailing slash (even though there is no trailing slash in the browser address)?
Thx