Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to specify path relative to site root?
    text
    copied!<p>i want to specify a path to a file relative to the root of the web-site. e.g.</p> <pre><code>&lt;script type="text/javascript" src="/Scripts/jquery-1.7.2.min.js"&gt;&lt;/script&gt; </code></pre> <p>In ASP.net that causes problems because the <em>"root"</em> of the <strong>site</strong> can be different from the root of <strong>server</strong>.</p> <p>e.g. Specifying <code>src</code> results in a <code>GET</code> from path</p> <pre><code>src="/Scripts/jquery-1.7.2.min.js" http://localhost:64276/Scripts/jquery-1.7.2.min.js 404 src="~/Scripts/jquery-1.7.2.min.js" http://localhost:64276/WebSite/Adminstration/~/Scripts/jquery-1.7.2.min.js 404 src="~Scripts/jquery-1.7.2.min.js" http://localhost:64276/WebSite/Adminstration/~Scripts/jquery-1.7.2.min.js 404 src="~/Scripts/jquery-1.7.2.min.js" runat="server" 500 Unexpected character '$' </code></pre> <p>How can i specify a <strong>site relative</strong> path when using HTML in ASP.net?</p> <h2>See also</h2> <ul> <li><a href="https://stackoverflow.com/questions/9700260/how-to-set-the-site-root-relative-path-for-localhost-on-iis-on-my-web-applicat">How to set the Site-Root Relative Path (for localhost) on IIS on my web application</a></li> <li><a href="https://stackoverflow.com/questions/4571755/asp-net-relative-path">ASP.NET relative path</a></li> <li><a href="https://stackoverflow.com/questions/7960094/relative-path-from-site-root">Relative path from site root</a></li> <li><a href="https://stackoverflow.com/questions/200863/jquery-visual-studio-error-cs1056-unexpected-character">JQuery: Visual studio, error CS1056: Unexpected character &#39;$&#39;</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload