Tuesday, 12 May 2009

401.1 Unauthorized access

IE7 Security Update KB963027

After installing this update IE7 stopped authorizing access to sites on our MOSS 2007 SP2 box. Unistall this update and it allows access.

If you leave the update in place (recommended) I found method 2 worked http://support.microsoft.com/default.aspx?scid=kb;en-us;896861

Host Headed Site Collections

Running through the creation of host headed site collections and deployment can be frustrating at times as there doesn't seem to be much documentation out there.

Our environment is an application/source server sitting within our domain and a WFE farm out in the DMZ. All content is sent to the WFE by content deloyment.

Create a standard publishing site on the application server with the required host header. Then with the stsadm createsite command with the values for the host header site collections - you can add the sitetemplate to the createsite command or login to each site and set the template from there.

Create a host headed blank site on the WFE and a blank site collection. Then with the stadm createsite command create the host headed site collections.

stsadm -o createsite -url hostheadedurl-owneremail owneremail-ownerlogin ownerlogin-hhurl rootsiteheadedurl-title sitetitle-sitetemplate BLANKINTERNETCONTAINER#0

[There are other options that can be set]

It was at this point that I found an issue where, if I used the STS#0 template as the sitetemplate the deployments later would not run. Login to each site and pick the blank site template and accept the permission defaults.

On the application server - content deployment - create a path from the root site collection to the root site collection on the WFE. You'll need to create a path for each of the host headed site collections and then create a job for each one.

Don't forget, as I did the first time round, to add the host headers onto IIS and either have them registered on your DNS or add them to the hosts file.

Edit: I forgot to mention that AAM will have no entries for these host headed site collections. You can add a flag to create the site with it's own content database if you need (maybe easier for the DBA to control)

Tuesday, 17 March 2009

StyleCop Update

An update for StyleCop was released on March 13. After removing the previous version and installing the new one I had to rerun the StyleCop for Resharper addin.

http://code.msdn.microsoft.com/sourceanalysis (v4.3.1.3 released March 13, 2009)

http://stylecopforresharper.codeplex.com/ (0.0.14317.000 released March 14, 2009)

http://stylefix.codeplex.com/ (haven’t tried this)

Wednesday, 4 March 2009

Adding Metadata to a MOSS 2007 Publishing Portal pt2

Add three columns to the Content Type that you use for WCM. In this example I've used PageTitle, PageDescription and PageKeywords.

Add the assembly to the Master Page and reference the MetaData dll
<%@ Register TagPrefix="metaControl" Namespace="MetaData.Render" Assembly="MetaData.Render, Version=1.0.0.0, Culture=neutral, PublicKeyToken=198d2f392e054e3e" %>

Example: In the head
<metaControl:SharePointMetaTag runat="server" ID="metaTag1" MetaName="DESCRIPTION" MetaAttributeName="Content" PublishingPagePropertyName="PageDescription" DefaultAttributeContent=""/>


The DefaultAttributeContent is where the editor has not completed the field as we've made them non manditory

namespace MetaData.Render
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
// using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

///
/// A webpart to render MetaData information onto a published page
///

[ParseChildren(false), ToolboxData("<{0}:MetaTag runat=\"server\" name=\"\"> "), PersistChildren(true),
AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal),
DefaultProperty("Name")]
public class MetaData : WebControl
{
///
/// Name to render out
///

private string name;

///
/// Initializes a new instance of the MetaData class.
///

public MetaData() : base(HtmlTextWriterTag.Meta)
{
}

///
/// Gets or sets the Tag name to render out
///

[Bindable(true), Category("Appearance"), DefaultValue(""), Description("Sets the MetaTag's name attribute.")]
public string Name
{
get { return this.name; }
set { this.name = value; }
}

///
/// Render the control
///

/// Render this writer
protected override void Render(HtmlTextWriter writer)
{
// Render control only if there is a tagname specified
if (!this.name.Equals(string.Empty))
{
base.Render(writer);
}
}

///
/// Add attributes to Render
///

/// The writer to add the attributes to
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
// Write the name attribute
writer.AddAttribute("name", this.name);

// Write the value attribute
StringWriter sw = new StringWriter();
base.RenderContents(new HtmlTextWriter(sw));
writer.AddAttribute("value", sw.ToString());
}

///
/// Render the content out
///

/// The writer to be rendered
protected override void RenderContents(HtmlTextWriter writer)
{
// this control does not render any contents
}
}
}

Thursday, 26 February 2009

Adding Metadata to a MOSS 2007 Publishing Portal

I found a way of adding MetaData to each page within a public facing website. There are still discussions on whether it is of any value, as some search engines don't always read it, to change the description and keywords.

In the Content Type(s) that the pages use add three fields - one for page title that will appear in the browser and will not affect the title used for the .aspx and in menus, one for the description as for some reason the description added when the page is created is not used (though I don't know it is crawled and returned in search results) and keywords.

I didn't add these fields to the page layout as there are lots of pages for our Marketing department, who own the content, to redo.

I'll post up the rest of the code tomorrow as I don't have the code at home.