Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically setting CSS values using ASP.NET
    primarykey
    data
    text
    <p>I'm working on a site where the images and other resources will be located on a separate domain from the main content of the site. We will use something like 'www.example.com' for the main site, and then 'images.example.com' for all extra resources for styles, etc.</p> <p>When developing the site I will keep all of these resources on local dev. machines. The challenge here is keeping CSS references consistent between the production server and development environments.</p> <p>What I was thinking of doing was creating a <code>web.config</code> key that would store the URL of the images server. Then, when switching from development to production I could just change the web.config value and everything would be done.</p> <p>Is there any way to add a value to a CSS file, dynamically or otherwise, from some place in a config or C# class? Or am I going about this the wrong way?</p> <p>Also, I'm limited to using .NET 2.0 if that makes a difference.</p> <p><strong>UPDATE</strong><br> To expand on this a little more, I know I can use a web.config setting for server controls' URLs. Those are already generated dynamically. What I'm more interested in is what options I have for modifying (or doing "<em>something</em>") to static CSS files that will allow me to change URLs for things such as background image resources that would be referenced in CSS. Is there anything I can do besides find/replacing the values using my IDE? Perhaps something that can be done automatically with a deployment script?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload