Sharepoint 2010: Create site from site template where alternate CSS url is set – unexpected error occured accessing site settings

Published on Author peter.stilgoe12 Comments

When you create a site template in Sharepoint 2010 where the template is taken from a site that has an alternate CSS url set, you find on the newly created site that when you try & access ‘Site Settings’ or ‘View all site content’ you get the ‘An unexpected error occured’.

In your logs you get something like:

System.Web.HttpException: Error executing child request for /sites/SiteName/Style Library/site-style.css

This appears to be a bug, you can fix the site by running the following Powershell script:

$w = Get-SPWeb http://YourServer/YourWeb; $w.AlternateHeader = $null; $w.Update()

12 Responses to Sharepoint 2010: Create site from site template where alternate CSS url is set – unexpected error occured accessing site settings

  1. same problem here.
    After executing you’re fix the problem went gone.
    But every time we make a new site, the problem still exists and we must execute the fix again.
    Hopefully Microsoft will release a permanent fix for this.

  2. Thank you so much. I made a template and created about 50 sites from it. I thought I would have to go back and manually create each one. This script worked perfectly and fixed all of my sites.

    You are a life saver! Add me as one more for wanting a permanent fix for this simple issue.

  3. running the script did fix the issue on a site already created. I wasn’t able to use it to fix the site the template was created from, but, I was able to save the template file (.wsp) to my local machine, unpack it (with 7-zip), then do a search for the string “alternateCssUrl” in all the files – it will find it in a couple of files – remove the value specified (so it reads like AlternateCssUrl=””
    Then re-package the files (re-creating the WSP) by following these instructions (it’s not too difficult)
    http://geekswithblogs.net/SoYouKnow/archive/2010/02/16/rebuilding-a-.wsp-file-in-4-easy-steps.aspx
    and then upload that template to the solution gallery.

    What a hassle!

Leave a Reply