Reputation: 1969
I have a problem with my a javascript file im refrencing to a master page.
this is the code:
<head runat="server">
<type="text/javascript" src="../Jquery1.6_vsdoc/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
the jquery files work fine, but the main.js not. when i open the aspex file on the web browser and do view source, and try to see the code on the main.js file iis show this message:
HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
what do i do worng here?
some info on the file (if it will help):
im using visual studio 2012 (sorry for my english)
Upvotes: 0
Views: 1506
Reputation: 6111
Use Page.ResolveUrl() in Master Page scenarios
so your reference should look like this
<type="text/javascript" src="<%= Page.ResolveUrl("~/Jquery1.6_vsdoc/jquery-1.7.1.min.js") %>"></script>
<script type="text/javascript" src="<%= Page.ResolveUrl("~/main.js") %>"></script>
This will ensure that the page is mapped correctly as the Child Page may not be in the same location as the Master Page
Upvotes: 1