The first attempt to solve this problem is use code blocks (<%= ... %>) with ResolveUrl, which give the following error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).
The second attempt is to use <%# ... %>) and ResolveUrl, but nothing is returned to the browser.
The third attempt is to data bind the HtmlHead in code behind of the master page, since it derives from Control:
In the master page write:
The css problem can also be resolved with:
The path is relative to the master page, and Asp.Net will solve the path based on the master page location.
A more elaborate solution would be to use resources and the WebResource.axd handler....