in my master page I have
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
and plenty other script/link elements. That works fine if rendered page in on the same level as master page file. If I try to access page that is in subfolder, request to js/css files is wrong.
I tried:
<script src="/js/jquery-1.7.1.min.js" type="text/javascript"></script>
but it only works if there’s no application virtual path. If my application is located under:
http://localhost/virtualPath/subfolder/Page.aspx
then request goes to:
http://localhost
I tried to use ResolveClientUrl, but my head is defined as
<head runat="server">
so I get an error. Is there a way to nicely solve that issue?
Note: I can’t remove runat from head tag as I’m using themes
you can add the link on the Init procedure using the server.mappath() function
http://www.dotnetgenerics.com/Modules/TricksAndTips/ASP.NET/PowerOfTilda.aspx
http://msdn.microsoft.com/en-us/library/ms524632(v=vs.90).aspx
This will not work in your preview on visual studio but will work.