Nick Swan's SharePoint Blog

a day in the life of a Sharepoint and .NET guy!

My Links

News




Post Categories

Archives

Blog Stats

Blogroll

Books

VB-tech website

VB-tech work

Xbox

Registration WebPart for Forms Authentication SharePoint 2007 sites

Once you’ve got your WSSv3 site setup for anonymous access and you’ve configured it for forms authentication you are probably going to want your users to be able to register themselves and start using various features on the site.

You could add the CreateUserWizzard to a page with SharePoint Designer, but I couldn’t find an easy way for users who register with this to have certain roles assigned to them. For example you create a role called registeredUser, and then in WSSv3 give this role contribute access to the whole site. If you just dropped the CreateUserWizzard on the page you’d have to manually go and assign this role to every new user who registered.

To try and make this process easier I’ve created a webpart that adds a CreateUserWizzard control, and hooks up to the CreatedUser event, so it assigns the role to the user as soon as the user registers. Here’s how to use it:

1, Make sure you have correctly implemented anonymous access and forms based authentication on your WSSv3 site. You can do this by reading the SharePoint Team blog:
http://blogs.msdn.com/sharepoint/archive/2006/08/16/702010.aspx
or watching Ted Pattisons video on Channel9
http://channel9.msdn.com/ShowPost.aspx?PostID=229709

You’ll also need to add a role of registeredUsers to your membership and roles db (aspnetdb)

Once you have FBA working download the webpart from here.

http://weblog.vb-tech.com/nick/registration.zip

Unzip it. Add the dll to the Global Assembly Cache, and add the following line to the safeControls section of web.config to make the control safe

<SafeControl Assembly="UserWebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bd6ea4a18b231b6c" Namespace="UserWebParts" TypeName="*" Safe="True" AllowRemoteDesigner="True" />

Save and close web.config. Browse to the page where you want to add the registration control, edit it, get the ‘Advanced webpart gallery’ side bar up, and select to import a webpart

Select the RegistrationWebpart.Webpart file that comes in the zip file along will the webpart dll. The webpart will appear as ‘untitled’ which I need to fix, but just drag and drop it on to the webpart zone that you want it and it appears. Click ‘Exit Edit Mode’ in the top right and you’re ready to go.

One more important thing is to give the role registeredUser contributor rights for the WSSv3 site. Login as the site administrator and go:

Site Actions -> Site Settings -> People and Groups -> New -> Add User

Type registeredUser into the first textbox and press CTRL + K to validate the roles exists. Check that the Contribute option is selected in the drop down and click OK.

Fantastic! Now your site visitors can register for your WSSv3 site and start posting to your discussion boards and other things straight away!

I quickly put this together last night so there’s plenty still to do:

1, Get the webpart to navigate back to default.aspx when the user has registered and clicked the continue button

2, Various webpart settings such as which group to add the users into when they’ve registered

3, Don’t show the webpart if the user is already logged in

4, Wrap it all up into a Feature with a registration page (makes it a nicer install as well!)

5, Look at doing the same for the password reminder control etc…

6, Perhaps look at incorporating registration steps to capture more data.

posted on Wednesday, September 27, 2006 12:51 PM

Get email alerts when this blog is updated!

Feedback

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 9/28/2006 11:04 AM Roy

Hi Nick!

Just wanted to let you know about the bug in the TR of Office Sharepoint Server 2007 that prevents anonymous visiting of a forms authenticated MOSS site. See: http://blogs.msdn.com/sharepoint/archive/2006/08/16/702010.aspx#766650
So, I'm assuming you've not gone to the TR release just yet ... possibly a good thing if anonymous access is a key feature for you at this time!

Thanks for the blog about setting up user self-provisioning. One comment, you start by saying "Once you’ve got your WSSv3 site setup for anonymous access"... Are you really setting up WSS v3 for anonymous access, or are you setting up MOSS (Microsoft Office Sharepoint Server 2007) that runs on top of WSS v3 for anonymous access?

Roy

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 9/28/2006 11:16 AM Nick Swan

Hi Roy,

I have WSSv3 Beta2TR setup and working ok with anonymous access and forms authentication. I do seem to remember it not working properly for MOSS 2007 Beta2TR though (although don't quote me on that! I might be getting mixed up with Beta2)

Cheers
Nick

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 9/28/2006 2:11 PM Roy

Nick,

Question: Is it impossible to create a plain WSSv3 web site once MOSS has been installed on a Server?

So I've configured a VirtualMachine with WSSv3 Beta 2 TR and MOSS 07 (Microsoft Office Sharepoint Server 2007) Beta 2 TR. With MOSS installed on this server, is it true that I can not then create a basic WSSv3 Web Site? If I create any new Sharepoint Web and related Site Collection using the Sharepoint 3.0 Central Administrator, and even pick blank site for a template, it appears to me that it is running as a MOSS extended site, and not a plain WSSv3 site.

If this is true (and I could have missed something), then in order to run a web site with forms authentication with anonymous access for the Internet zone using Beta 2 TR (note to others: this will work for the final RTM of MOSS I'm told ... it's only a MOSS Beta 2 Technology Refresh issue/bug), I'd have to either uninstall MOSS on this server, or create a fresh install (a different VM) and refrain from installing MOSS.

Is this correct, or have I missed something?

Thanks!
Roy

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 9/29/2006 6:47 AM Nick Swan

Hi Roy,
To be honest as with all beta2tr things until I try them I can't say for definite myself whether that'd work or now. What you say makes sense though that once Moss is installed all new site collections are going to be run as moss 2007 extended sites.

It could just be something with particular site templates as well that stop them working with anonymous access/forms auth.

I'll try and do some testing this weekend and let you know how I get on. If you find out anything more from your own testing let us know!
Cheers
Nick

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 10/10/2006 10:49 AM sylwia

Is it possible that you give a link to your source code?

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 11/14/2006 9:41 AM Udo

Hi Nick,

have you find out anything more from your testing concerning the anonymous access/forms auth. on MOSS b2tr??

Thanks.
Udo

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 2/14/2007 5:00 AM praveen

i created a new MOSS 2007 portal site,
i imported all users in my active directory using ssp admin site,
my question is ,How i add these users in my MOSS portal site
if i click people and groups-->all people
i m able to see only my name (logined by me,so)
i want all the names in my active directory
please help me
thanks in advance

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 3/26/2007 6:10 AM Jeremy Thake

I downloaded the zip and copied the dll and registered it. And then added the web part by importing it and when I clicked to add it to the page, nothing appears on it. The web part is avaliable to drag and drop on and is called Untitled. Any help would be greatly appreciated.

# re: Registration WebPart for Forms Authentication SharePoint 2007 sites 3/26/2007 6:25 AM Jeremy Thake

I downloaded the zip and copied the dll and registered it. And then added the web part by importing it and when I clicked to add it to the page and I get a alert window with the following in it:
Unable to add selected web part(s):
RegistrationWebPart: Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallersAttribute set for import to succeed.

I do not have access to the GAC on my hosted server, only to the bin directory. Is there a way around this?

Title  
Name  
Url
Comments - All Comments are moderated and will not be displayed until approved by this blog's author    
Enter the code you see: