Installing the Web Part - Step 3

The SharePoint Forums Web Part is made up of two .NET assemblies. One is the user interface and contains the Web Part itself, the other contains the backend logic and services code.

In order for SharePoint to trust the assemblies and let them execute, entries have to be added to the web.config file in the SafeControls section. This lets SharePoint know explicitly what files are trusted and what ones are not.

The web.config file is a simple text file and can be edited with Notepad. It is located in the folder where the virtual directory for the web site runs. This is normally c:\inetpub\wwwroot but your administrator may have setup things differently and this may not be the location of the file.

You can find the location of your web.config file with the Internet Information Services snap-in. The Internet Information Services snap-in is an administration tool for IIS that has been integrated with other administrative functions of Windows Server. To launch the Internet Information Services snap-in:
  1. Click Start, point to Programs, point to Administrative Tools, and click Computer Management.
  2. Under the Server Applications and Services node, expand Internet Information Services.

To locate where your web.config file is:
  1. Launch the IIS snap-in as described above
  2. Expand the Web Sites item in the tree
  3. Locate the web site running your SharePoint installation (normally Default Web Site)
  4. Right-click on it and select Properties
  5. Select the Home Directory tab

The Local path contains the physical location of where the web.config file will be.

Inside the web.config file they'll be a section called SafeControls with entries similar to this:

    Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=.." 
    Namespace="System.Web.UI.WebControls" TypeName="*" Safe="True" />
    Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=..." 
    Namespace="System.Web.UI.HtmlControls" TypeName="*" Safe="True" />
    Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=..." 
    Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" />

To register a Web Part as a safe control for use in Windows SharePoint Services, in the SafeControls block, add a SafeControl element that specifies the Web Part in the web.config file.

Add the following entries for the SharePoint Forums Web Parts to this section:

  Assembly="BilSimser.SharePoint.WebParts.Forums, Version=, Culture=neutral, PublicKeyToken=e516dadc23877c32" 
  Namespace="BilSimser.SharePoint.WebParts.Forums.Controls" TypeName="*" Safe="True" />
  Assembly="BilSimser.SharePoint.WebParts.Forums, Version=, Culture=neutral, PublicKeyToken=e516dadc23877c32" 
  Namespace="BilSimser.SharePoint.WebParts.Forums" TypeName="*" Safe="True" />
  Assembly="BilSimser.SharePoint.WebParts.Forums, Version=, Culture=neutral, PublicKeyToken=e516dadc23877c32" 
  Namespace="BilSimser.SharePoint.WebParts.Forums.Controls.Common" TypeName="*" Safe="True" />
  Assembly="BilSimser.SharePoint.WebParts.Forums, Version=, Culture=neutral, PublicKeyToken=e516dadc23877c32" 
  Namespace="BilSimser.SharePoint.WebParts.Forums.Controls.Base" TypeName="*" Safe="True" />

Now the SharePoint Forums Web Parts are registered as safe in your SharePoint installation.

Last edited Jun 3, 2006 at 2:53 PM by bsimser, version 5


No comments yet.