When trying to access Site Settings for a Site which is created on basis of a Site Template which has an Alternace CSS Url configured you will receive an unexpected error:
|SharePoint Foundation Runtime tkau Unexpected System.Web.HttpException: Error executing child request for /Style Library/Style.css|
This is caused because the Site Settings page doesn’t access the CSS at the Site Collection Root
but instead searches for it in the layouts folder
Pete wrote a PowerShell script to fix the problem afterwards:
$w = Get-SPWeb http://YourServer/YourWeb; $w.AlternateHeader = $null; $w.Update()
But since this does not solve the actual problem, you always have to embed the reference to your StyleSheet in the MasterPage.
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/Style.css %>" After="corev4.css" runat="server" />
But don’t forget, when you use SharePoint Foundation $SPUrl will not resolve, since this requires the Publishing Feature.
So in SharePoint Foundation you should reference your CSS like this:
<SharePoint:CSSRegistration name="/Style Library/Style.css" After="corev4.css" runat="server" />