Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Web Parts in VB.Net

  Asked By: Dianna    Date: Jan 21    Category: MOSS    Views: 1756

Does anyone have any experience with developing web parts in VB .Net
that can help point me in the right direction? I've been giving a client
some guidance on developing web parts, but they are more comfortable
developing in VB.net, and I've always written in C#.

The problem we are running into is that the web part, when adding it to
the page, gives the familiar message about the web part not being
registered on the site as safe. And when trying to add the web part to
the web part gallery, it is not listed in the available options.

Here's what I've done so far, which is pretty much the same as what I do
for C# web parts:

1) Strongly named the assembly

2) Added the AllowPartiallyTrustedCallers reference.

3) Extracted the public key token and added a reference to the
class and namespace in the safe controls section of the web.config.

4) Saved the dll in the bin folder.

The part where I think I may be getting hung up on is the
AllowPartiallyTrustedCallers reference. Not being familiar with the
VB.net development environment, I'm not sure I put this in the right
place.

I also tried to convince them to learn C#, but that didn't work either.

And if there is something else I am missing, I would appreciate some
guidance.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Akshay Gupta     Answered On: Jan 21

You might want to pick up the Rational Guide to creating web  parts (or
something close to that name) that gives you step by step instructions
for creating and adding  it to the site. I don't have it in front of
me to reference  to help  you out right now.

 
Answer #2    Answered By: Trinity Scott     Answered On: Jan 21

I have developed webparts in both VB and C# and never ran into any
language issues. Are you familiar  with Install Assemblies? Are we
talking '03 or '07? If '03 then go here http://msdn2.microsoft.com/en-
us/library/ms964439.aspx and locate the link to installassemblies. It
will take a DLL and create the DWP and perform all other steps
required. Great tool.

If you are using '07, VS 2005 has an add-in that automates the
deployment of web  parts as well.

 
Answer #3    Answered By: Constance Guerrero     Answered On: Jan 21

I use VB.Net for most of my Sharepoint 2007 web  parts. If you're
wondering about the AllowPartiallyTrustedCallers it goes in the
AssemblyInfo.vb and should look like this:

<Assembly: AssemblyVersion("1.0.0.0")>

<Assembly: AssemblyFileVersion("1.0.0.0")>

<Assembly: Security.AllowPartiallyTrustedCallers()>

I'm still using the DWP file, creating a cab from that and then using
stsadm to install it and that's been working great (the stsadm should
make the appropriate changes to the web.config to mark it as a safe
assembly). I noticed when the Sharepoint Extensions for Visual Studio
came out they only supported C#. I went the road of creating my own VS
VB template but couldn't get it to do everything I wanted it to so
instead I created a project where you fill in a couple of parameters and
then it generates a VB.Net WebPart that's ready to go. It's tailored
for my environment  at the moment (adds company specific classes into it)
but I could easily remove those and share the source.

 
Answer #4    Answered By: Caleb Gordon     Answered On: Jan 21

I have developed webparts in both VB and C# and never ran into any language
issues. Are you familiar  with Install Assemblies? Are we talking '03 or '07?
If '03 then go here msdn2.microsoft.com/en-us/library/ms964439.aspx
and locate the link to installassemblies. It will take a DLL and create the
DWP and perform all other steps required. Great tool.

If you are using '07, VS 2005 has an add-in that automates the deployment of
web parts  as well.

 
Didn't find what you were looking for? Find more on Web Parts in VB.Net Or get search suggestion and latest updates.




Tagged: