My ASP.NET MVC app uses some external javascript and jquery files. Everything works just fine on my dev machine. As soon as I post it to my server none of the .js files even load. I have used Url.Content() as well as an app helper with the same result. They work fine on the dev machine but don't even load on when published to the server. I am really at a wall and have no idea what this could be. Any ideas what I could try next? Thanks
I have tried
<script src="../../Script开发者_运维问答s/SiteMaster.js" type="text/javascript"></script>
as well as
<script src='<%=Url.Content("~/Scripts/SiteMaster.js") %>' type="text/javascript"></script>
both work on the dev machine neither work on the server.
ResolveUrl
should be all you need
<script
src="<%=ResolveUrl("~/Scripts/SiteMaster.js") %>"
type="text/javascript"></script>
also make sure you've added this IgnoreRoute:
routes.IgnoreRoute("scripts/{*pathInfo}");
I found the Issue!!! my other programmer created a virtual directory (for some reason) named "scripts" in IIS and had it pointed at a different location on the file system. I appreciate all your help with this! I have fixed it. Thanks Again!
精彩评论