title: ASP.Net Master Page and File path issues
body: <p>I'm trying to add a script reference to jQuery in my master page so that it will work for any page. It currently looks like this</p>
  
  <pre><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The problem is that the path is always relative to the executing aspx page so this will only work if the "jquery.js" file is located in the same folder. To make it work I have to change the line to:</p>
  
  <pre><code>&lt;script type="text/javascript" src="../../jquery.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>This is obviously less than ideal because it will only work for pages that are two levels deep from the root folder. If I try the following, IIS throws an error about an unexpected character.</p>
  
  <pre><code>&lt;script runat="server" type="text/javascript" src="~/jquery.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>EDIT:</strong> I forgot to mention as well that the script MUST be in the head tag</p>
  
  <p>The current top answer throws a "<em>ASP.NET Ajax client-side framework failed to load.</em>" error when I add it to my master page. Its thrown from javascript and not the .Net compiler. If I move the ScriptManager to the head section where it should be I get a compile error about the ScriptManager needing to be inside a form tag.</p>
  
  <p>The third answer throws a "<em>Illegal characters in path.</em>" exception from the compiler</p>
  
  <p><strong>EDIT 2:</strong> When I add that line to my head tag I get this error from IIS.</p>
  
  <p><em>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %>)</em></p>
  
  <p><strong>SOLVED:</strong> I took the edited response from the answer below and put it inside an <em>asp:ContentPlaceHolder</em> element</p>