Link to home
Start Free TrialLog in
Avatar of aero-owner
aero-owner

asked on

Adding a simple web part.

Hello experts,

I've been tasked with setting up some web parts so that our marketing dept can do whatever with the apps we write, but I've hit a snag.

As with any new task, I start with the easy one.

So I followed the instructions that Suraj Poozhiyil ( http://www.sharepointcustomization.com/resources/demos.htm ) from Microsoft shows to just build a simple Hello World web part.

Got the template in VS.Net, loaded in C# and VB (but I'm using C#)

Create the web part library, rename it to MyHelloWorld

Change output.Write(SPEncode.HtmlEncode(Text)); to output.Write('Howdy World");

Change the output directory to the bin directory on my sharepoint site (I have sharepoint and vs.net on the same box...and I have some confusion on this, as I'm not a share point guy...not sure I have the right directory...in IIS it shows my _vti_bin to be C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\isapi  which also has bin directory one step down, I have tried both of those and the inetpub\wwwroot\bin directory to no avail)

Build the app.

Go into sharepoint, edit page, import and browse to my MyHelloWorld.dwp, hit upload and then it displays on the tool bar.

However, when I try and drag it on the page I get "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."

According to the demo I watched...I did everything as told...so I dug a little further.

Using SA.exe I strongly named my assembly, dragged it to c:\windows\assembly got the key from the properties

edited my web.config file (the one in the home directory for my sharepoint site) with <SafeControl Assembly="MyHelloWorld, Version=1.0.0.1, Culture=neutral, PublicKeyToken=6b6979e152d8c840" Namespace="HelloWorldWebPart" TypeName="*" Safe="True" />

copied keypair.snk to the root of C: (and all 3 bin directories) and changed my assembly.cs to show c:\\keypair.snk for the location.

ever after all of this...still getting "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."

What am I missing?

Thanx in advance,

Brian
Avatar of cjones_mcse
cjones_mcse
Flag of United States of America image

I'm pretty new to this myself but it sounds like you may need to establish the public key token. Here's a link to info on that:

http://www.msd2d.com/newsletter_tip.aspx?section=sharepoint&id=ca2d1f37-e1e8-4d6d-99a5-4dffeb255491
Oops
Missed that you did that already, sorry.
Avatar of alimu
Hi Brian,
I'm pretty new to sharepoint too, but came across this and it may be worth a look,
there is a sample here followed by a number of comments from those who experienced a similar sounding problem to yours:
http://weblogs.asp.net/jan/archive/2004/03/04/84011.aspx  fixes varied from changes to dll permissions through to problems with the version number used in the safecontrol version number.
hope it sheds some light,
AJ.
ASKER CERTIFIED SOLUTION
Avatar of _TAD_
_TAD_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
aero-owner it's been over 2 weeks since you posted the question and you haven't provided us with any feedback yet... solving a problem's a two-way street could you please comment on the suggestions provided?  
thanks,
AJ.