Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET CSS
In site.css file,
 

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

working in deployment .but not coming in published site.
Posted 12-Dec-12 23:44pm
massab363
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
massab at 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
Marcus Kramer at 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.
Marcus Kramer at 13-Dec-12 12:59pm
   
+5.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Try this.
 
background-image:url('~/Content/themes/base/images/redback.jpg');
 
This may resolve your problem.
 
Thanks
  Permalink  
Comments
Christian Graus at 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)

  Print Answers RSS
0 OriginalGriff 386
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 215
3 Maciej Los 169
4 /\jmot 169
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100