Adam Bickels
Adam Bickels

Reputation: 471

ASP.net resolve url in css external file

I separate the css from the *.aspx file. When this

background-image: url('<%=Page.ResolveUrl("~/Themes/Red/Images/Contestant/1.jpg)%>';)

was in the aspx file it worked, and now it's not working.

do you know any other way ?

Upvotes: 0

Views: 5651

Answers (2)

Adil
Adil

Reputation: 148120

The scriptlet and ~ here is specific to aspx file and could not be used in css.

Change

background-image: url('<%=Page.ResolveUrl("~/Themes/Red/Images/Contestant/1.jpg)%>';)

To

background-image: url('/Themes/Red/Images/Contestant/1.jpg')

The above assumes the Themes folder is at root your your site.

To give path relative to css

background-image: url('Themes/Red/Images/Contestant/1.jpg')

Upvotes: 3

Adam Bickels
Adam Bickels

Reputation: 471

this is what fix my problem

background: url(../../../image.png)

Upvotes: 0

Related Questions