Just little about C#, .NET, SQL Server, SharePoint and SAP

Using CreateUserWizard in MOSS Web Parts

Posted by zieglers on September 14, 2008

Using CreateUserWizard in normal ASP.NET .aspx pages can be very straightforward. However when you want to use it in web parts for MOSS, definitely there are some little details that you need to know to make it functional as expected.

First problem I had was related to MembershipProvider property. I provided AspNetSqlProvider as my provider name for that property value, and I get the ‘unexpected error’ page.. When I removed it, everything seemed to work ok. It was working all good for another sample project that i developed to test the usage of Form Authentication with CreateUserWizard.

Then, I realized that without providing MembershipProvider property, control was functioning as expected. This was because CreateUserWizard control, when membership info not provided, was inheriting this property’s value from the current MOSS web site’s web.config. So, if you want to use this control in a user control loader as a MOSS web part, you don’t need to provide MembershipProvider property.

Second problem that you may face, once the user is created successfully and page is redirected to the one you provided in ContinueDestinationPageUrl property, the page is being loaded with the recently created user’s credentials. Since you haven’t added this new user to your MOSS site, you’ll get Access Denied error. So, in order to resolve this issue, you need to set LoginCreatedUser property of the control to false, so that page is loaded with the original user’s credentials, not with the one’s recently created.

Also, if you want to check out a nice sample code on Login, Role and Profile usage in ASP.NET 2.0, you might want to read this post as well: http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: