I've found about five different tutorials on creating web part in C# in Visual Studio.NET. I have no problem creating the web part but I'm missing something about moving it to the SharePoint Server and droppping it on the page.
I'm getting the error:
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.
after uploading the web part and trying to drop it on the page.
I've created the strong name with the sn.exe and I've added to my assembly.cs file: [assembly: AssemblyKeyFile("c:\\keypair.snk"] and then copied the keypair.snk to the c drive on the SharePoint Server. I've even referenced it other ways: "..\\..\\keypair.snk".
I've dropped my assembly into the C:\WINDOWS\assembly directory to determine the public token key and entered that into my dwp file:
<Assembly>SimpleWebPart, Version=1.0.0.1, culture=Neutral,
PublicKeyToken=463f397437b56b46</Assembly>
and I've added the assembly to the web.config file on the SharePoint Server:
<SafeControl Assembly="SimpleWebPart, Version=1.0.0.1, Culture=neutral, PublicKeyToken=463f397434346b46" Namespace="MyWebParts" TypeName="*" Safe="True" />
I've done this same procedure about five times with different methods of deployment and different simple beginner web part code: with a cab file, with the Wppackager.exe program, one with the Web Part Library in Visual Studio.NET, and once with a manual process. Each time the same results. When dropping the control onto the page I get that it isn't safe.
Can anyone tell me what I'm missing here? I've even tried dropping the assembly into the GAC but get the same results. We are using SharePoint 2003 on the server.
I'm getting the error:
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.
after uploading the web part and trying to drop it on the page.
I've created the strong name with the sn.exe and I've added to my assembly.cs file: [assembly: AssemblyKeyFile("c:\\keypair.snk"] and then copied the keypair.snk to the c drive on the SharePoint Server. I've even referenced it other ways: "..\\..\\keypair.snk".
I've dropped my assembly into the C:\WINDOWS\assembly directory to determine the public token key and entered that into my dwp file:
<Assembly>SimpleWebPart, Version=1.0.0.1, culture=Neutral,
PublicKeyToken=463f397437b56b46</Assembly>
and I've added the assembly to the web.config file on the SharePoint Server:
<SafeControl Assembly="SimpleWebPart, Version=1.0.0.1, Culture=neutral, PublicKeyToken=463f397434346b46" Namespace="MyWebParts" TypeName="*" Safe="True" />
I've done this same procedure about five times with different methods of deployment and different simple beginner web part code: with a cab file, with the Wppackager.exe program, one with the Web Part Library in Visual Studio.NET, and once with a manual process. Each time the same results. When dropping the control onto the page I get that it isn't safe.
Can anyone tell me what I'm missing here? I've even tried dropping the assembly into the GAC but get the same results. We are using SharePoint 2003 on the server.