0

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="../../Scripts/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.

12
  • can you post "how" you're linking to your external js files? <link> tag or what? Commented Nov 29, 2010 at 17:11
  • Yes of course. Post is updated with these. thanks Commented Nov 29, 2010 at 17:15
  • And you've confirmed the files are on the server? Commented Nov 29, 2010 at 17:22
  • Are you sure your server has access to that ../../ directory? Commented Nov 29, 2010 at 17:22
  • Jfar, I just double confirmed that the files are there... they are there. however now there is a red ! on the script Icon. I don't know what this means. Commented Nov 29, 2010 at 17:24

2 Answers 2

3

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}");
Sign up to request clarification or add additional context in comments.

4 Comments

same result. Works on the dev machine not on the server.
did you try navigating to that url? baseUrl + "/scripts/sitemaster.js"?
well, there you go, you should check the /scripts/ folder to see if there are ANY files in there.
as I said. On the server the files ARE there. But my other programmer created a new virtual directory named scripts and had it pointed to another directory. So when using IE /scripts/ was going to this other directory that the new virtual directory was pointed to. thats where It was getting confusing. thanks for your help though.
0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.