RE: Web Part Unsafe



Hey Chris,

Try this: DON'T strong name your assembly, remove the old dll from the GAC,
put the dll in the BIN directory, use a simple entry in web.config (
<SafeControl Assembly="hello" Namespace="Hello" TypeName="*" Safe="True" /> )
-- make sure the casing is correct-- and use /_layouts/1033/newdwp.aspx to
create your DWP.

For WSS development, have you considered using a Visual Studio Express
version (which would also require WSS SP2 running on ASP.NET 2.0)? (BTW-- at
this time, MS only recommends this for WSS development, not SPS).

Daniel Larson


"Chris" wrote:

> I have an assembly called hello_sn.dll. I register it in the GAC with the
> ..net configuration tool. I add an entry to the webconfig in the wwwroot. I
> then create my dwp and upload it to the default site. When I go to import I
> get an error saying the web part is unsafe. What I am doing wrong? This
> version of win2003 is out of the box and this the fiirst thing I have tried
> on it so there may be configuration issues. Where am I going wrong??
> Regards, Chris. The only unusual thing is I didn't create the dll with the
> web template as I can't afford VS.net. I compiled it as a module with
> vbc.exe and then used al.exe to assign the strong key and version
> information. I don't think it is that as I wouldn't be able to install it to
> the GAC.
>
> Web Config Entry
> <SafeControl Assembly="hello_sn, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=c28f363c7292dd31" Namespace="Hello" TypeName="*" Safe="True"
> />
>
>
> DWP
> <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"; >
> <Title>My Web Part 1</Title>
> <Description>The first web part I created.</Description>
> <Assembly>hello, Version=1.0.0.0, Culure=Neutral,
> PublicKeyToken=c28f363c7292dd31</Assembly>
> <TypeName>Hello.HelloWebPart</TypeName>
> <!-- Specify default values for any additional base class or custom
> properties here. -->
> </WebPart>
>
>
> Source Code
> namespace Hello
>
> public class HelloWebPart
>
> Inherits Microsoft.SharePoint.WebPartPages.WebPart
>
> Protected Overrides Sub RenderWebPart(ByVal Output as
> System.Web.UI.htmlTextWriter)
>
> output.write("my first web part")
>
> End Sub
>
> End Class
>
> End Namespace
>
>
>
>
.



Relevant Pages

  • Re: Help with encrypting connection strings
    ... I have everything working correctly out of the GAC. ... Token in the web.config entry to the one created when I installed the ... dll to the GAC). ... example namespace first with similar results. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Help with encrypting connection strings
    ... I have everything working correctly out of the GAC. ... Token in the web.config entry to the one created when I installed the ... dll to the GAC). ... example namespace first with similar results. ...
    (microsoft.public.dotnet.general)
  • Re: Namespace Question
    ... Usually GAC used the version to manage the Assembly, ... Also I think the IIS cache the dll is for performance concern. ... below under the <Configuration> item. ... Look into the Figure 10 in the Section Advanced Administrative Control ...
    (microsoft.public.dotnet.languages.vb)
  • Re: GAC and app.config in .NET 1.1
    ... Leave it local unless GAC is a requirement. ... I have a DLL and an application which uses it. ... ProviderConfiguration config = ... it can't access the configuration anymore. ...
    (microsoft.public.dotnet.framework)
  • gac registration
    ... dll in the GAC? ... Does an entry have to be made in the machine.config file for ... it register and load correctly? ...
    (microsoft.public.dotnet.framework)