background image of a css loaded as an embedded re

2019-09-17 09:34发布

问题:

I have a control created in a Class Library and it should be styled by default with some CSS. I've created a CSS file, added it to the library and I am embedding it as a resource, so that it can be used for the default styling.

The CSS file contains some classes that set the background-image property. The images used for this are added as embedded resources in my library as well. As expected, the CSS will run correctly, but it will not display the images since they are added relative to the css file, so a request for ../images/my_image.png will result in a 404 since it actually does not exist as my_image.png, but downloaded as a .axd resource.

Any ideas on how to overcome this?

Any and all help is greatly appreciated.

Kali.

回答1:

Why not having done this myself I remember reading an article for getting the javascript in an embedded resource.

Accessing Embedded Resources through a URL using WebResource.axd http://www.4guysfromrolla.com/articles/080906-1.aspx