ASP.NET MVC 2 relative paths for scripts and styles
- by Tomaszewski
Hi, having this really silly problem in ASP.NET MVC 2 with .NET 4.
I need to test other pages using localhost, but sometimes I need to show the page to some else on another computer and so need to path out to my machine. In doing so, I need to use relative paths for my and tags. When I test through VS, I use relative path:
<script src="../../Scripts/somejavascript.js"></script>
<link href="../../Styles/somestyle.css" />
However, when I publish to local IIS, I'm having all sorts of problems beacuse the Scripts and Styles folder are at the same directory level, but it seems like I have to path out differently. For example, in the scenario above the styles will be picked up but the JavaScript won't be.
Any ideas on how best to path out, relatively using MVC 2?