Response
Just sharing my solution here since I couldn't answer my own question until 8 hours had passed:
I managed to resolve the issue. By removing Server.MapPath from the PreRender function, I was able to render it correctly. It was just a silly mistake on my part. Thank you all for your help.
In my code snippet, I included:
CssIncludes.Add("~/Sites/0/PageLayouts/Predefined/News/CSS/HeaderMenu.css");
After being rendered on the page, it appeared in the source as:
<link href='C:\inetpub\wwwroot\mysite\Sites\0\PageLayouts\Predefined\News\CSS\HeaderMenu.css' type='text/css' rel='stylesheet' />
If I manually copy that CSS URL and paste it into my browser, the CSS loads without any issues. However, it still doesn't show up at c:\localhost\mysite\!
Does anyone have any suggestions?
List of CSS Includes:
public List<string> CssIncludes
{
get
{
if (_cssincluded == null)
_cssincluded = new List<string>();
return _cssincluded;
}
}
void Page_PreRender(object sender, EventArgs e)
{
foreach (string css in CssIncludes)
{
Page.Header.Controls.Add(new LiteralControl(string.Format("<link href='{0}' type='text/css' rel='stylesheet' />", Server.MapPath(css))));
}
}