To convert relative image paths to absolute path there are many questions asked and answered in stackoverflow like this one:

MVC4 StyleBundle not resolving images

that suggest adding new CssRewriteUrlTransform() as below:

bundles.Add(new StyleBundle("~/Content/css/jquery-ui/bundle")
       .Include("~/Content/css/jquery-ui/*.css", new CssRewriteUrlTransform()));

and this actually have saved me before. but now that I deploy my website to an application (not root of a website) there is still a problem:

the application is:

http://localhost/sample/

but the image urls are like:

http://localhost/css/imgs/spirit.png

while it should be:

 http://localhost/sample/css/imgs/spirit.png

although the css link itself is correct and working.

Related posts

Recent Viewed