0

I am very new to MVC 4. Here I am facing a issue related to URL reference of assets.

I have used bundle configuration to render my css and scripts.

@Scripts.Render("~/Content/scripts/location")

One of my script is using URL of a CSS and that CSS uses some images.

1.Image issues:

Actual reference : http://localhost:58752/Scripts/lib/sample/img/east-mini.png

404 error with following link http://localhost:58752/Location/img/east-mini.png

2. CSS reference issue

Actual reference :http://localhost:58752/Scripts/lib/sample/theme/default/style.css

404 error with following link http://localhost:58752/Location/theme/default/style.css

Please help me to resolve my issue.

1
  • Provide how you reference these images in a CSS class definition. Commented Mar 2, 2015 at 11:16

1 Answer 1

1

Images and other resources inside a CSS file should always be referenced as relative to the location of this CSS file itself.

So for example if you have Location/theme/default/style.css and wanted to reference Location/theme/images/foo.png you should use ../images/foo.png inside your CSS.

Sign up to request clarification or add additional context in comments.

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.