Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In site.css file,


background-image:url('../../Content/themes/base/images/redback.jpg');


working in deployment .but not coming in published site.
Posted

Relative paths are always the work of the devil. Clearly your root is different, so the relative path breaks ( or the image is not there ). Use absolute paths.
 
Share this answer
 
Comments
massab 13-Dec-12 4:52am    
Thanks for reply.
BUt ,HOW TO use...I tried LIKE 'url('images/redback.jpg').but not working.

then in controller,
string img = null;
img = "../../FoodImages/" + Convert.ToString(reader[4]);
That too not working
all coming in deployment !.Time to host website and all these issues coming up.pls help
fjdiewornncalwe 13-Dec-12 13:01pm    
STOP USING RELATIVE PATHS. Use absolute paths. ie. DO NOT USE "../../whatever/yourfile.gif" syntax, use "/whatever/yourfile.gif" instead.
fjdiewornncalwe 13-Dec-12 12:59pm    
+5.
Hi,

Try this.

CSS
background-image:url('~/Content/themes/base/images/redback.jpg');


This may resolve your problem.

Thanks
 
Share this answer
 
Comments
[no name] 13-Dec-12 7:02am    
Yes I am understanding your problem. As I am saying you just try that at your code.
Or else if you have fire bug installed in firefox then check for the file path of the image and Do your R&D to findout your actual path of the image. If still not able to produce then I will show you a different way.
Christian Graus 13-Dec-12 13:59pm    
Instead of saying over and over 'it's not working', try to understand what you're doing, don't act at random. Try this solution without the ~, the ~ is wrong outside of code that knows how to parse it, but you do need a / at the front to be absolute

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900