Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Installing webparts

Status
Not open for further replies.

ndevriendt

Programmer
Jan 8, 2002
74
BE
Hello,

I'm very new on sharepoint and I'm now trying to create webparts.
I've created a web part library project with one webpart. I've assiging a strong name with the sn.exe command. I have installed the dll on the server with the tool
InstallAssemblies.exe and this works fine.

Now I've added a second web part to my project. And also installed on the server with InstallAssemblies.exe, and when I try to import the second webpart (the first works still fine) I get the error that my webpart is not safe for this site. Before I have reinstalled my dll file
I've maked an uninstall with the stsadm.exe tool.

My DWP file of my second webpart looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns=" >
<Title>SiteLinks</Title>
<Description>SiteLinks Web part.</Description>
<Assembly>SiteInfo, Version=1.0.0.0, Culture=neutral,PublicKeyToken=e43b29a784e2849d</Assembly>
<TypeName>SiteInfo.SiteLinks</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>
The DWP file of my first webpart that works fine looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns=" >
<Title>Welcome</Title>
<Description>WebPart1.</Description>
<Assembly>SiteInfo, Version=1.0.0.0, Culture=neutral,PublicKeyToken=e43b29a784e2849d</Assembly>
<TypeName>SiteInfo.Welcome</TypeName>
<!-- Specify initial values for any additional base class or custom properties here. -->
</WebPart>

In the web.config file I have the following safecontrol tag

<SafeControl Assembly="SiteInfo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e43b29a784e2849d" Namespace="SiteInfo" TypeName="*" Safe="True" />

Can somebody tells me what I do wrong ?

Thanks for your time and answer

Devriendt Nico
 
Yes in your dwp do: <Typename>[namespace].[assembly]<Typename>
But the assembly tag of you second dwp example is incorrect instead of "SiteInfo" it should read "Welcome".

This is assuming that SiteInfo is you namespace then your first dwp isn't right either there assembly is supost to read "SiteLinks".

And you need 2 Safecontrol tags:

<SafeControl Assembly="SiteLinks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e43b29a784e2849d" Namespace="SiteInfo" TypeName="*" Safe="True" />

<SafeControl Assembly="Welcome, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e43b29a784e2849d" Namespace="SiteInfo" TypeName="*" Safe="True" />

I hope this helps!

btw, why do you install with InstallAssemblies.exe, why not use stsadm.exe for this too?

example:
cd \Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\gacutil.exe /i "C:\<DLL Location>\<DLL Name>.dll
 
I've used InstallAssemblies because I've read this in a book of Micorsoft 'Sharepoint Portal Services Inside Out' I will also try the gacutil.exe program too.

Thanks for your answers.

Devriendt Nico
 
Lol i just reread my own post an saw i told u to install the Assamblys with stsadm.exe, this ofcourse has to be the gacutil.exe as the example shows.

You could also consider to place the assemblys (dlls) in the bin folder of the virtual web server (also called Website in IIS). You then also have to set the trust level to Full trust.. But personaly i like the GAC!

Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top