views:

56

answers:

2

I'm curious about the best/most efficient way to do this.

I've already set up my sharepoint 2010 site, and it is configured to use FBA. What i'd like to do is allow users to create their own accounts by filling out a form (the form will sit on a public sharepoint site, and filling it out creates a user in the membership database which is used for validation to enter the FBA sharepoint site).

I'm familiar with using the asp CreateWizard tool to build user accounts as part of a .Net web application, but I'm not sure on how to develop this as a webpart for use in a sharepoint site, as a webpart doesn't have the config file to store connection string and membership/role provider info.

Can this user creation form be put in a webpart and deployed to other sites, or is there another/better way to add this functionality to sharepoint (allowing users to register/create their own FBA accounts for access)?

A: 

CKS FBA contains the following Web Parts for SharePoint 2007:

User Login
This web part is extremely customizable including changing prompts, error messages, and turning on/off links to registration pages or password change pages. When the user logs in successfully they will see a link under the "Welcome User" control at the top of the page called "My Settings". Click on this will let the user change their SharePoint user settings.

User Registration
This web part is highly customizable. In addition to the standard CreateUserWizard controls, this registration control adds fields for the First and Last names as well as a CAPTCHA field to avoid programmatic registrations. When a user registers on the site an email will be sent letting them know that their account information has been received and that their membership is pending.

Change Password
This web part will allow the user to modify their password. All prompts and error messages are customizable.

Password Recovery
This web part allows a user to request a password reset by answering the questions they created when the account was registered. This web part also allows modification of all prompts and error messages.

I have no idea if the WSP file will install on SharePoint 2010, but the source code is available, so you can see how the Web Parts are implemented.

Marek Grzenkowicz
I've downloaded the source code, but after going through it I think it does so much more than I need right now that I'm a little overwhelmed, but it's definitely a good resource, thank you.
Felipe K
A: 

There's nothing not much difference between SharePoint and regular ASP.Net for this.

The membership provider will need to be configured in the SharePoint web.config, including connection strings. However, it does not actually need to be used for login, so you can still create users in that membership provide from a different site.

I use a slightly different approach though - set up an anonymously accessible page in your site (in layouts is probably easiest, though a page within a site may be better for branding) and put controls on that page to create (and log in) a new user. You will need to call EnsureUser and possibly CreateUserProfile to give the new user access to anything, but aside from that it's all standard .net.

Tom Clarkson
interesting, I didn't know you could have public pages in an FBA site. Can I do all this in sharepoint designer 2010? I tried adding the <asp:createwizard> control to a new page but sharepoint designer threw an error saying that tag is not allowed in xhtml 1.0
Felipe K
Oh, and adding the connection string and membership provider info to the site web.config worked perfectly, thanks, but now i'm curious as to how it can be done with just an aspx page and user controls
Felipe K
With difficulty. There's nothing to stop you connecting to a database with a hardcoded connection string or instantiating a particular membership provider, but you probably won't be able to use the out of box components.
Tom Clarkson
Designer should work, though I haven't tried that - you may find that that error is actually just a warning - the tags available on the actual site are not necessarily the same as the ones vs/designer thinks are available.
Tom Clarkson
I moved on to building the pages through visual studio 2010 rather than using sharepoint designer, and I had another follow-up that maybe you could advise me on (if not, don't worry, you've been more than helpful already).As I've said, it's an FBA site and I followed this example to create the pages (http://blogs.msdn.com/b/kaevans/archive/2010/06/28/creating-a-sharepoint-site-page-with-code-behind-using-visual-studio-2010.aspx)
Felipe K
Sorry, that last comment came out weird. Anyway, I tried building a site page and ran into a different issue which I posted here http://stackoverflow.com/questions/4034891/create-user-wizard-causes-error-on-sharepoint-site
Felipe K