1

My MVC application can be accessed using the following three methods:

http://domain-name/app - Images and JS files are not loading

http://server-name/app - All content files are loading perfectly

http://ip-address/app - Images and JS files are not loading

Images and JS files are not loading when accessed through domain name and ip-address. All content files are loading perfectly using server name. Any thoughts on this?

1
  • Could you provide some code? Commented Mar 4, 2014 at 11:41

1 Answer 1

1

Are you using absolute paths when referencing your images and js files in your views or layouts?

Using relative paths should resolve this issue:

<script src="~/Scripts/Mycript.js"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

i'm using relative paths like this <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" /> and it is working perfectly when we are accessing through server name. Is there any issue with directory permission like allow, deny etc?
Try opening up Chrome(f12) or use Firebug(f12) and look at the exact path of the image that is not being found/generated. You should see a red x marker when navigating to your page while using firebug or chrome. If you're using relative paths then my only other assumption is that the files exist in the correct path on the server and not in the others.

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.