MVC3 Relative URL Paths - Javascript

I have an issue with relative paths whereby when the web app is running off subdirectory of the domain, the paths are not correct. e.g. http://www.example.com/webapp/

If I use @Url.Content("~/path/to/action") on the page it is fine. I can even embed the @Url.Content("") inside the javascript script. I want to clean up the page I wanted to put the javascript inside a js file and reference that. Now that the @Url.Content is being called inside the javascript file, it doesn't seem to work (probably for obvious reasons). How can I get around this issue?

I had a look at the but that doesn't seem to work.

7
задан Vadim Kotov 10 September 2019 в 07:52
поделиться