I wasn’t a heavy back end guy but I’ve got my hands on some server control now, which returns CSS to another aspx page that expects the CSS in a <link/> tag in the page head. Something like this:
<link rel="stylesheet" type="text/css" href="Style.aspx?id=15" />
And code file of the Style.aspx page is as simple as:
string style = string.Empty; // ... // Grab style from DB. // ... Response.Clear(); Response.Write(style); Response.End();
I realised that none of the browsers but IE recognises the styles correctly.
After a bit of trial and error + research, I found out that it was because I didn’t set the web response header correctly before return it.
What I was missing is just one line of code before calling the end for the response:
I also found that you can’t use
Response.Headers.Add("", "") to add the header entry, but didn’t go deeper looking into the reason though 🙂