Archive for the ‘TechNotes’ Category

Kerberos authentication and NLB clusters

November 24, 2008 Leave a comment

When you use Kerberos as the authentication mechanism with Sharepoint and want to configure NLB for load balanced front-end servers you will have to configure an extra SPN for the NLB cluster name. This is caused by the fact that Kerberos uses the hostname as a part of the Kerberos Ticket request, even if the URL used is something different. This is described in detail in Microsoft KB929650.

With the following scenario, set the SPN names accordingly:
NLB server A:
NLB server B:
NLB Cluster Name:
Web Application Account: MyDomain\SharepointApp

SPN commands for NLB with Kerberos for the described scenario:
setspn.exe /A HTTP:// MyDomain\SharepointApp
setspn.exe /A HTTP:// MyDomain\SharepointApp
setspn.exe /A HTTP:// MyDomain\SharepointApp

Please note that all computer and application accounts must be enabled as trusted for delegation!



iFrame page template for MOSS

November 17, 2008 Leave a comment

As you all know, the web page viewer web part included in Sharepoint does not support dynamic sizing of the iFrame it creates. Because of this, I found the need for a page template which users might use to create a Sharepoint page with external content. The following code is the entire page template, which might be used as is by anyone it might suit.

Please not that the javascript variable FooterHeight has to be set according to the whitespace you would like at the bottom the page. The height of 30 pixels is based on the footer height of the default collaboration master included in Sharepoint 2007.

<%@ Page language="C#" Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" %>
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>   <asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
   <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
<asp:Content ContentPlaceholderID="PlaceHolderPageTitleInTitleArea" runat="server">
   <SharePointWebControls:TextField runat="server" id="TitleField" FieldName="Title"/>
<asp:Content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
   <PublishingWebControls:editmodepanel runat="server" id="editmodestyles">
     <!-- Styles for edit mode only-->
     <SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/zz2_editMode.css %>" runat="server"/>
   <SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/rca.css %>" runat="server"/>
   <SharePointWebControls:FieldValue id="PageStylesField" FieldName="HeaderStyleDefinitions" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server">
   <div class="breadcrumb">
     <asp:SiteMapPath ID="siteMapPath" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
   <SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/pageLayouts.css %>" runat="server"/>
   <table id="MSO_ContentTable" cellpadding="0" cellspacing="0" border="0" width="100%">
           <div class="pageContent">
             <PublishingWebControls:RichHtmlField id="content" FieldName="PublishingPageContent" runat="server"/>
        <td style="padding-top: 5px;">
     <WebPartPages:WebPartZone runat="server" FrameType="None" AllowPersonalization="false" Title="<%$Resources:sps,LayoutPageZone_BottomZone%>" ID="MiddleLeftZone" Orientation="Vertical" QuickAdd-ShowListsAndLibraries="false" allowlayoutchange="false"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <!-- _locID@Title="L_MiddleLeftZone_Title" -->
   <PublishingWebControls:editmodepanel runat="server" id="editmodepanel1">
     <!-- Add field controls here to bind custom metadata viewable and editable in edit mode only.-->
     <table cellpadding="10" cellspacing="0" align="center" class="editModePanel">
             <PublishingWebControls:RichImageField id="ContentQueryImage" FieldName="PublishingRollupImage" AllowHyperLinks="false" runat="server"/>
           <td width="200">
             <asp:label text="<%$Resources:cms,Article_rollup_image_text%>" runat="server" />
<script language="JavaScript">
    function resizeFrame() {
      objFrame = document.getElementsByTagName("iframe").item(0);
      windowHeight = document.body.offsetHeight;
      headerHeight = absoluteTop(objFrame);
      iframeHeight = windowHeight - (headerHeight + footerHeight);
      if (iframeHeight >=0) { = iframeHeight}; = "1px solid gray"; = "0px";
    }       function absoluteTop(objNode) {
      var currentNode=objNode;
      var sumTop=0;
    return sumTop;
    }       function getFooterHeight() {
      objPlaceHolder = document.getElementById("ctl00_MSO_ContentDiv");
      footH = document.body.offsetHeight - (absoluteTop(objPlaceHolder) + objPlaceHolder.offsetHeight);
      return footH;
    }       var footerHeight = 30;
    window.attachEvent ("onresize", resizeFrame);
    window.attachEvent ("onload", resizeFrame);
  //  resizeFrame();
  //  footerHeight = getFooterHeight();
  // -->


Configuring a web application for proxy

October 2, 2008 Leave a comment

For some mysterious reason, the web proxy auto detect setting in the web.config file for a web application does not work that well. Thankfully it’s possible to specify proxy settings manually in the web.config file by adding the following entries in the <> section:

   <proxy proxyaddress="http://%5BServerIP%5D:%5BPort%5D&quot; bypassonlocal="true" />
     <add address="" />

To revert to the default auto detect setting, replace the section above with the following:

    <proxy autoDetect="true" />


Ekskludering av virtual directory

August 18, 2008 Leave a comment

I enkelte tilfeller kan det være ønskelig å ekskludere et virtual directory fra en IIS web site som kjører .NET applikasjoner. F.eks. kan det være en eldre ASP applikasjon som ønskes kjørt innenfor samme namespace som en .NET applikasjon.

For å få dette til må man få IIS til ikke å håndtere den virtuelle applikasjonen som en .NET applikasjon, og den enkleste måten å gjøre dette på er å ekskludere den fra web.config filen på applikasjonen og fjerne .NET extensions på den virtuelle mappen.

Måten å ekskludere en mappe fra en .NET applikasjon er å legge inn følgende linje i web.config under <configuration> seksjonen:
<location path="[path]" allowOverride="true"/>

For å fjerne .NET extensions på den virtuelle mappen, gjør følgende:

  1. I IIS Manager, høyreklikk på den virtuelle mappen og velg properties.
  2. Under Virtual Directory tabben klikk på Configuration knappen.
  3. Fjern alle .dll referanser fra listen Wildcard application maps.

Etter at dette er gjort må IIS restartes (iisreset /noforce).

%d bloggers like this: