Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SPS 2003 - Web Parts

  Asked By: Haley    Date: Apr 16    Category: Sharepoint    Views: 945

I have some customized web parts in the portal. When I try to export the
web part, I get this error message:

A Web Part or Web Form Control on this Web Part Page cannot be displayed
or imported because it is not registered on this site as safe.

Does anybody know how I can resolve this?



6 Answers Found

Answer #1    Answered By: Audra Mccormick     Answered On: Apr 16

In c:\inetpub\wwwroot\bin folder, add an entry in web.config to mark it as

Answer #2    Answered By: Christina Lewis     Answered On: Apr 16

Can you tell me what line it is? I've never played around with the
webconfig file.

Answer #3    Answered By: Meaghan Webster     Answered On: Apr 16

This article will help you:

Fixing web  Parts From the Web Part Not Registered As a Safe Control Error

My "Working With the Web Part Templates" article series was written for SPS
Beta 2 and it worked great at the time. When Technical Refresh of Beta 2 was
released, some of the architecture of SPS changed. To do anything more than
the most basic things, you need to register your parts  as safe and load them
in the GAC.

In your dwp, you need to change the block to include the public key token.
Here are the basic instructions:

1) Run the sn.exe utility to create a key for your assembly (the util is
somewhere under the Visual Studio path, you shoud may want to search for
it). The syntax should look like:
sn -k c:\key.snk

2) In the assembly Info file of your web part, change the version # listed
thre from (or 1.0.0.*) to Also under the PublicKeyFile
field (which is toward the bottom). Add in the quotes C:\\key.snk

3) Build your web part, take the DLL that was built and copy it to
C:\Windows\assembly (this is a GAC). Then right click the assembly and
choose properties. Copy the PublicKeyToken (and for the rest of the steps we
are going to pretend that it is 64bf77798fbca80 but you should use your own
when you follow the steps)

4) Go back to your Project and open the DWP file. Change the following:

<Assembly> AssemblyName </Assembly>


<Assembly AssemblyName, Version=, Culture=Neutral,
PublicKeyToken=64bf77798fbca80 </Assembly>

5) Build the project. This should rebuild your CAB with the new dwp file.

6) When importing the cab, you want to use:
stsadm -o addwppack -filename filename.cab -globalinstall -force
The globalinstall parameter there is necessary becasue that will tell the
installed to add the part to the GAC and register it as safe in the
web.config file.

7) Run iisreset - when you install safe web parts to the cache, you need to
reset IIS before they will be available

8) (optional) before reinstalling new web parts, I usually run:
stsadm -o deletewppack -name filename.cab
just to make sure the old one is deleted first. Other say this isn't
necessary, which is probably true, but I like to do it just to be safe.

Once you have done those steps for your assembly, test to make sure the web
parts import. You should not see the safe controls error message now. Also,
once you have completed these steps and your parts successfully import, you
do not need to perform these steps again for this project. You can change
the code all you want and just follow steps 6-8 to delete and reinstall the
updated parts.

Please post questions in the discussion boards, or email me with comments
and concerns.

Answer #4    Answered By: Sunny Delacruz     Answered On: Apr 16

The entry should come within the tags



And should look something like this

<SafeControl Assembly="System.Web, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.HtmlControls"
TypeName="*" Safe="True" />

The assembly should also be in the Global Assembly Cache (GAC) for it to
work i.e. %systemdrive%\windows\assembly

Answer #5    Answered By: .net Guru     Answered On: Apr 16

This is great when you have a customized web  part that you have created.
But I'm currently using the built in web part that came out of the box
(Web Page Viewer). I figured I don't have to do anything to this web
part to make it safe since it's out of the box. I cannot export this web
part since I keep getting this error message.

Answer #6    Answered By: Renata Burt     Answered On: Apr 16

If i have only *.dwp file? how can i make it safe ?

Didn't find what you were looking for? Find more on SPS 2003 - Web Parts Or get search suggestion and latest updates.