I actually do the same thing in my forums. I dynamically load a stylesheet and populate other various data within the head tag. I built a custom control that extends the literal control. Here is the code:
NOTE: You could also use a databinding expression within the head tag.
Code:
namespace VegaSoft.VSForums.Controls
{
using System;
using System.Web;
using System.Web.UI;
using VegaSoft.VSForums.Web;
using VegaSoft.VSForums.Config;
public class SkinManager : LiteralControl
{
public SkinManager()
{
string content = "";
if (ActiveUser.IsLoggedIn())
content = String.Format("<title>Vega Forums Message Board (Logged in as: {0})</title>", ActiveUser.Name);
else
content = "<title>Vega Forums Message Board</title>";
content += String.Format("\n<link href='{0}style/styles.css' type='text/css' rel='stylesheet' />", ActiveUser.PathToSkin);
content += String.Format("\n<script src={0}></script>", Configuration.PathToScripts);
base.Text = content;
}
}
}