Sharepoint: AlternateHeader cannot be unset

Today I had a bit of a nightmare when trying to ensure that the AlternateHeader of a web was set to blank (it had previously had a custom header applied). Unfortunately I could not find a simple solution to this, and unfortunately had to resort to altering the sharepoint db (this is not recommended / supported by Microsoft).

The following code does not behave as expected:

currentWeb.AlternateHeader = "";

It would appear that when the AlternateHeader is set (as above), the stored proc “proc_UpdateTpWebMetaData” is called (in the xx_SITE database). This contains the following check:

AlternateHeaderUrl = CASE WHEN @AlternateHeaderUrl IS NULL THEN AlternateHeaderUrl ELSE @AlternateHeaderUrl END,

There are two solutions to the issue:

The first one is too modify the stored proc, removing the check – i.e. AlternateHeaderUrl = @AlternateHeaderUrl END, (note that I am not sure what implications this may have on other areas of the code).

The second solution is to simply edit the webs table in the sharepoint xx_SITE database. Simply select the relevant list item in enterprise manager and reset its AlternateHeader value.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>