Re: Trusted Web Part
From: Mike Walsh (englantilainen_at_hotmail.com)
Date: 02/04/05
- Next message: ekmhenry: "Cannot connect to the configuration database."
- Previous message: Mike Walsh: "Re: Question about column"
- In reply to: Robert E: "Re: Trusted Web Part"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 4 Feb 2005 19:30:46 +0200
I suppose it's about time for me to come in and say that threads on WSS
programming including web part creation should go to the sub newsgroup for
them which is
microsoft.public.sharepoint.windowsservices.development
(Just so you know next time - please then post programming questions only
there)
Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please post questions to the newsgroup only.
"Robert E" <RobertE@discussions.microsoft.com> wrote in message
news:93088EBF-35B7-4E07-BC42-F10D21C9C641@microsoft.com...
> Thanks, that fixed it. I am not sure why it did not work when it was not
in
> the GAC. But that can be for another day.
>
> Thanks, again!
>
> "Andre Strik" wrote:
>
> > Whether your web part assembly is in the GAC or not you need to have an
> > entry in the SafeControls section that relates to your web part
assembly.
> > This section is used by SharePoint to ensure web parts are trusted as
safe,
> > and in the case of an installed web part throwing errors and breaking
the
> > current site it is installed on, you can temporarily set its Safe
attribute
> > to false and continue working with the current web as the web part will
then
> > not be loaded.
> >
> > From what you have said below I gather the following:
> >
> > .. You have a web part and you have strong named the assembly
SPSSubSites,
> > Version 1.0.0.0 PublicKeyToken=449965ab5555b8a0
> > .. Safe control entry in the web.config file:
> > <SafeControl Assembly="SPSSubSites, Version=1.0.0.0,
Culture=neutral,
> > PublicKeyToken=449965ab5555b8a0" Namespace="SPSSubSites" TypeName="*"
> > Safe="True" />
> > .. Dwp File
> > <Assembly>SPSSubSites</Assembly>
> > <TypeName>SPSSubSites.Lister</TypeName>
> >
> > From looking at this you have a strong named assembly, which your are
> > registering as a safe control in your web.config file, but for your web
part
> > description (dwp) file you are referencing as a non-strong named
assembly.
> > Therefore when you try to install the web part by dragging it onto the
web
> > site it gives you get the untrusted web part error. This is because
> > SharePoint uses the dwp to match up the webpart with the assembly and
checks
> > that it has been defined as safe when installing a part on a site. This
> > mismatch is occurring because your dwp file references and your assembly
do
> > not match.
> >
> > This should fix your problem:
> >
> > Replace the contents of your dwp file with the following and then
attempt to
> > reinstall your webpart.
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
> > <Title>SPSSubSites</Title>
> > <Description>This WebPart lists some stuff</Description>
> > <Assembly>SPSSubSites, Version=1.0.0.0, Culture=neutral,
> > PublicKeyToken=449965ab5555b8a0</Assembly>
> > <TypeName>SPSSubSites.Lister</TypeName>
> > </WebPart>
> >
> > Cheers
> >
> >
> >
> >
> > "Robert E" <Robert E@discussions.microsoft.com> wrote in message
> > news:F8942CC6-B35B-4158-AFB2-7EEEBE7B55C2@microsoft.com...
> > > Thanks Jim,
> > >
> > > I had already tried the GAC but I just tried it again and it still
does
> > not
> > > work.
> > >
> > > BTW, for clarity, whe I add them to the GAC I do not to place a
> > > corresponding entry in SafeControls, right? This is more for clarity
> > because,
> > > I also tried this both ways.
> > >
> > > "Jim Buyens" wrote:
> > >
> > > > Here are some things to try:
> > > >
> > > > Restart IIS then try again.
> > > >
> > > > Delete the SafeControls entries and drag the Web Part dll into the
> > Global
> > > > Assembly Cache (that is, into \windows\assembly), then restart IIS.
> > > >
> > > > If that works but you don't want your Web Part in the GAC, they
either:
> > > > o Your Safe Cotnrols entries were wrong, or
> > > > o You have multiple WSS virtual servers on the same machine. There
are
> > > > issues with this configuration that force you to put your Web
Part
> > in
> > > > the GAC.
> > > >
> > > > If putting the Web Part in the GAC and restarting IIS doesn't solve
the
> > > > problem, then your strong name and/or version are incorrect.
> > > >
> > > > Another approach is to download the Web Part Toolkit from the
SharePoint
> > > > Technologies Resource Kit or from
> > > > http://www.bluedoglimited.com/Downloads/default.aspx, install it on
your
> > > > server, and then use the InstallAssemblies tool to install the Web
Part.
> > > >
> > > > Jim Buyens
> > > > Microsoft MVP
> > > > http://www.interlacken.com
> > > > Author of:
> > > > *----------------------------------------------------
> > > > |\---------------------------------------------------
> > > > || Microsoft Windows SharePoint Services Inside Out
> > > > || Microsoft Office FrontPage 2003 Inside Out
> > > > ||---------------------------------------------------
> > > > || Web Database Development Step by Step .NET Edition
> > > > || Microsoft FrontPage Version 2002 Inside Out
> > > > || Faster Smarter Beginning Programming
> > > > || (All from Microsoft Press)
> > > > |/---------------------------------------------------
> > > > *----------------------------------------------------
> > > >
> > > >
> > > > "Robert E" wrote:
> > > >
> > > > > Hi, I created a Web Part and modified the DWP,
> > > > > Manifest.XML, web.config files as directed. I created a
> > > > > strong key and extracted the public key. I then inserted
> > > > > the public key in the SafeControls section of the
> > > > > Web.config and changed the default trust level to medium.
> > > > > Finally, I made sure my class name and namespace were
> > > > > consistent thought all requisite files.
> > > > >
> > > > > I am able to import the Web Part into SharePoint but when
> > > > > I attempt to drag it onto a Page, I get that it is an
> > > > > untrusted Web Part. The typical error when attempting to
> > > > > use an untrusted Web Pat.
> > > > >
> > > > > All details are below.
> > > > >
> > > > > And it does not work. I know I am missing something
> > > > > obvious but I cannot figure it out. Any ideas? Again, the
> > > > > details are contained below.
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > >
> > > > >
> > > > > SPSSubSites (Project)
> > > > >
> > > > > SPSSubSites.vb
> > > > > <DefaultProperty("ShowAllSites"), ToolboxData("<
> > > > > {0}:Lister runat=server></{0}:Lister>"), XmlRoot
> > > > > (Namespace:="SPSSubSites")> _
> > > > > Public Class Lister
> > > > >
> > > > > SPSSubSites.dwp
> > > > > <Assembly>SPSSubSites</Assembly>
> > > > > <TypeName>SPSSubSites.Lister</TypeName>
> > > > >
> > > > > Manifest.xml
> > > > > <Assembly FileName="SPSSubSites.dll">
> > > > > Namespace="SPSSubSites"
> > > > > <DwpFile FileName="SPSSubSites.dwp"/>
> > > > >
> > > > > C:\intetpub\wwwroot\bin\SPSSubSites.dll
> > > > > Sn -t spssubsites.dll
> > > > > 449965ab5555b8a0
> > > > >
> > > > > C:\inetpub\wwwroot\web.config
> > > > > <SafeControl Assembly="SPSSubSites, Version=1.0.0.0,
> > > > > Culture=neutral, PublicKeyToken=449965ab5555b8a0"
> > > > > Namespace="SPSSubSites" TypeName="*" Safe="True" />
> > > > >
> > > > > <trust level="WSS_Medium" originUrl="" />
> > > > >
> > > > >
> > > > > .
> > > > >
> > > > >
> > > > > --
> > > > > Robert E
> >
> >
> >
- Next message: ekmhenry: "Cannot connect to the configuration database."
- Previous message: Mike Walsh: "Re: Question about column"
- In reply to: Robert E: "Re: Trusted Web Part"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|