<p>For example, if I have a page located in Views/Home/Index.aspx and a JavaScript file located in Views/Home/Index.js, how do you reference this on the aspx page?</p>

<p>The example below doesn't work even though the compiler says the path is correct</p>

<pre><code>&lt;script src="Index.js" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>The exact same issue has been posted here in more detail:
<a href="http://forums.asp.net/p/1319380/2619991.aspx" rel="nofollow noreferrer">http://forums.asp.net/p/1319380/2619991.aspx</a></p>

<p>If this is not currently possible, will it be in the future? If not, how is everyone managing their javascript resources for large Asp.net MVC projects? Do you just create a folder structure in the Content folder that mirrors your View folder structure? YUCK!</p>

You can use the VirtualPathUtility.ToAbsolute method like below to convert the app relative url of the .js file to an absolute one that can be written to the page:
```
```
<script type="text/javascript" src="<%=VirtualPathUtility.ToAbsolute("~/Views/Home/Index.js") %>"></script>
```
```