This project has moved and is read-only. For the latest updates, please go here.

How to use Membership Request Functionality ?

Jun 3, 2011 at 10:43 AM

Hi How to use Membership Request Functionality ? as far as my requirement i need only add member to database in what way can i do please suggest me Thanks

Jun 3, 2011 at 5:35 PM

Just add the Membership Request web part to a SharePoint page. You'll also have to allow anonymous access on the page (or only users logged on to the site will be able to use it).

Jun 6, 2011 at 8:24 AM
Edited Jun 6, 2011 at 8:46 AM

Hi ccoulson if i want to add more fields to the membership webpart apart from email,first name ,last name how can it be done?

In brief i want to add create password field to the existing fields.

Is their anyway it can be done please suggest me.


Jun 6, 2011 at 12:48 PM

Yeah, that can definitely be done. Just download the source code, then you can edit the web part in Visual Studio.

Jun 6, 2011 at 1:08 PM

Hi How can we get the Credentials for Team Foundation Server?

Jun 6, 2011 at 1:12 PM

You don't need them to download the source code. Just download the source code from the downloads page, or click on a change set on the Source Code page and click download.

If it's prompting you when you open the source code in Visual Studio, just click cancel.

Jun 6, 2011 at 3:24 PM

Hi ccoulson i got it but am getting  Login Failed Error how to correct it?


Jun 6, 2011 at 3:45 PM

Where are you getting the Login Failed error from? TFS? You don't need to be connected to the CodePlex TFS to develop.  If you are prompted for a password, just hit cancel and it will say it will work offline.  If you don't want to get prompted for a password anymore, just go to Source Control -> Change Source Control to disassociate the code from the CodePlex TFS.

Jun 7, 2011 at 5:01 AM
Edited Jun 7, 2011 at 9:42 AM

Hi am not getting error from TFS i have given my site url and deployed and it deployed successfully but when i fill all the fields in membership request webpart and click Create User It showing [LOGIN FAILED FOR USER i.e. DOMAIN\USERNAME].

I have login with Primary Administrator and it is showing Login Failed For Secondary Administrator.

Jun 7, 2011 at 1:54 PM

I'm not sure.  Did you change any of the code before deploying? Do the other web parts work properly? How about the user management screens?

Jun 7, 2011 at 2:07 PM


i didnt change any code and i didnt check other web parts when put in debug mode and check it is getting all fields like verification code and image but finally it's throwing that error.

i will check with other web parts and let you know


Jun 8, 2011 at 11:32 AM

Hi chris again i have downloaded the code and i have given web application url and i have deployed it shows the error

Error occurred in deployment step 'Add Solution': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 0 0 Visigo.Sharepoint.FormsBasedAuthentication

Where did i do wrong?


Jun 8, 2011 at 1:56 PM

I sometimes get access denied (but I think a different access denied message), and restarting the "Windows Management Instrumentation" service (or rebooting the machine) fixes it.

Make sure though that the user you are logged on with is a SharePoint administrator and that they can login to the url specified via Windows Authentication.

Jun 9, 2011 at 8:10 AM

HI Chris please if you dont mind can you give me a hint or suggest me in what way i can write code for password and confirm password which i can insert into Membership web part.


Jun 9, 2011 at 1:24 PM

Hi chris i deployed successfully and when i attach debugger and check it is showing 

'Error Sending Mail Notification '

How can i resolve this bug.


Jun 9, 2011 at 4:04 PM

In regards to adding the change password and confirm password functionality, all I can suggest is to look at the code for the Membership Request and other web parts. In particular look at the MembershipRequestControl and the class it derives from - CreateUserWizard:;k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV3.5%22);k(DevLang-CSHARP)&rd=true

As for the Error Sending Mail Notification - that usually means that there's a problem with your SharePoint email setup. Check your settings in Central Admin Outgoing Email Settings, as well as the settings for the web application.

Jun 9, 2011 at 4:13 PM

If you would like customizations to the FBA Pack, I do offer those services through my company.  If you're interested, contact me via the Contact Us page on

Aug 4, 2011 at 12:34 PM
Edited Aug 4, 2011 at 12:42 PM

when i  place  the membership request webpart on login page and  i fill all  the fields and  click the button  i am  routed  back to login page  ,but  if  i place membership webpart in  a sharepoint page then  iam  able to add  new user after  clicking the sumbit.

the error  iam  getting using  first  method is

 system.unauthorized access exception for _ _layouts/fba/emails/membershipprovider.xslt

system.unauthorized access exception for  _layouts/fba/emails/membershiperror.xslt

system.unauthorized access exception for  _layouts/fba/emails/membershippending.xslt

system.unauthorized access exception for  _layouts/fba/emails/membershipRejected.xslt

system.unauthorized access exception for  pages/passwordquestion.aspx

system.unauthorized access exception for  pages/changepassword.aspx


please help urgent



Aug 4, 2011 at 1:43 PM

I can't say i've tried that.  What I usually do is add a link to the login page to a seperate Register page.  Have you created a custom login page, like here:

? Or are you modifying the actual built in SharePoint 2010 login page?

Potentially some code in the login page is conflicting with the web part - but that will be pretty tough to debug as it's not available (without reflecting the code).

Why not just put a link to a separate page?

Aug 12, 2011 at 9:53 AM


    I have a requirement where a new user needs to signup for the site. For that I used the membership request webpart in the application page but the user not

getting email for temporary password, but if same webpart is placed in a site page and login with some credentials and sign up for new user then an email

is received to whatever email is provided during signup. But this won't satisfy the requirement, the sign up page should be anonymous. Can you tell me am I

missing anything

Aug 12, 2011 at 6:12 PM

I've replied to the duplicate question you posted here:

Sep 27, 2011 at 10:29 AM
Edited Sep 27, 2011 at 10:42 AM

i have added  custom fields(Phone and Contract Number) to membership request webpart, user name, password are  stored in the database,  but custom field values like  phone and contract  values are not stored in the data base  please help me  with small example 

Sep 27, 2011 at 11:28 AM


  Have  you added  custom fields to  membership request webpart and  store that values in database??  please  help  if  you have done  urgent


Sep 27, 2011 at 2:05 PM

When I've added extra fields, i've stored them in SharePoint on the user profile.  If you'd like to do that, here's a couple of links that should lead you in the right direction:

Sep 28, 2011 at 7:31 AM

Thks for the quick reply, i was able to solve the problem using  following way, i used this in oncreated event




newUser = Membership



Guid newUserId = (Guid




FirstName = request.PhoneNumber;



LastName = request.CbsAccountNumber;


string connectionString = ConfigurationManager.ConnectionStrings["SQLConnectionString"



string insertSql = "INSERT INTO Profile(UserId,FirstName, LastName) VALUES(@UserId, @FirstName, @LastName)"



using (SqlConnection myConnection = new SqlConnection





SqlCommand myCommand = new SqlCommand

(insertSql, myConnection);



, newUserId);



, FirstName);



, LastName);




Sep 28, 2011 at 7:34 AM


  Iam using Password recovery webpart its working fine , how  can  i  use  same  webpart  if  user  forgets  his  UserName/Email  and remembers only password. Urgent can we do in sharepoint 2010??

Sep 28, 2011 at 1:44 PM

That seems strange. By looking up a user by password, you run the risk of multiple users having the same password - so you could end up giving a user access to an account he shouldn't have access to.  You also make your site easily accessible to hackers - as they can just start entering common passwords until they find a user with that password. So I wouldn't recommend this. If you really want to do it, there is no method for doing it via the SqlMembershipProvider, so you would have to extend it and write your own.

Sep 29, 2011 at 10:49 AM


  Thanks for the quick reply, i  will tell my  client the same  and  sure  they will agree.

Sep 29, 2011 at 10:54 AM


This is regarding membership Registration,

Before creating user i have to chek in database for  contract  number whether  it is valid contract number  or not  where  should i  write this code,oncreating  or  oncreated ??

Sep 29, 2011 at 2:45 PM

OnCreating - because you're still able to cancel the creation if the contract number is not valid.  

Since (I assume) you'll have to add another field with the contract number, you might just want to add a custom validator to it and do the validation there.

Sep 30, 2011 at 6:31 AM


  yes  you are  correct,  and thanks for the suggestion.


Oct 11, 2011 at 10:36 AM

How  i should add captcha to the passwordrecoverywebpart in FBA?  very  urgent

Oct 11, 2011 at 2:00 PM

Look at "AddHipControls" of "MembershipRequestControl.cs".  That's essentially the code that adds it to the Membership Request webpart.  So i'd just take that and work at adding it to "PasswordRecoveryWebPart.cs"

Oct 21, 2011 at 3:02 PM



  iam using createuserwizrad control in visualwebpart and adding user the user is added in the database but not appearing in the Form auth, its unable to find the user? please help me  out  very urgent..should i set any attributes in the control my settings are as follows

<asp:CreateUserWizard runat="server" ID="CreateUserWizard1" OnCreatedUser




BorderColor="#616D7E" BorderStyle="Solid" BorderWidth="2px"





RequireEmail="True" DisableCreatedUser="false" OnCreatingUser="CreateUserWizard1_CreatingUser" CompleteSuccessText="Your Account has been Created" CreateUserButtonText="Submit" CreateUserButtonStyle-Font-Bold="true" ContinueDestinationPageUrl="~/_layouts/CBS.MyCBSOutdoor.Application/customlogin.aspx" >


Oct 21, 2011 at 3:06 PM

The CreateUserWizard will only add the user to the membership database.  If you want the user to appear in SharePoint you have to add the user to a group. Why don't you just use the Membership Request Control, which does all this for you?

Oct 21, 2011 at 3:33 PM

when i add using your membership request webpart, the user is added perfectly and seen in Form auth.

for above case and  for your membership request webpart, for both iam using same web.config files.

Oct 21, 2011 at 3:38 PM

i have some customizations, so iam using create user wizrad control, the concept like  i create a sub site add that user to the sub site as owner of the site? to do so what should do plase help me out

Oct 21, 2011 at 3:42 PM

Look at the MembershipRequest.cs code and copy the portion for adding the user to a SharePoint group into your code. Modify as needed.  That should do it!

Oct 21, 2011 at 3:42 PM

iam using

SPGroup ownersGroup = web1.Groups["TestFBA Owners" 


ownersGroup.AddUser(UserName, UserName, UserName,"New User"




// ownersGroup.AddUser(spUser);


 is this the correct way.

Oct 21, 2011 at 3:47 PM

Here's the line of code that does it for the membership request web part:

web.SiteGroups[request.DefaultGroup].AddUser(Utils.EncodeUsername(request.UserName.ToLower(), web.Site), request.UserEmail, request.FirstName + " " + request.LastName, "Self Registration");
The one thing you're missing is encoding the username into the claims format with Utils.EncodeUsername.
Oct 21, 2011 at 4:02 PM

thanks very much iam trying that, if  all goes well i will reply immediate

Oct 21, 2011 at 4:14 PM
Edited Oct 21, 2011 at 4:17 PM


"TestFBA Owners"].AddUser(UserName, UserName, UserName, "New User"





); it says The user does not exist or is not unique. the user is in database........please help me

 soory i have not used web.sitegroups iam cheking that


Oct 21, 2011 at 4:21 PM

its give the same erro like The user does not exist or is not unique. the user is in database........please help me

Oct 21, 2011 at 4:23 PM

As I mentioned, you can't just pass the username. You have to encode it first.  See the line of code that I posted.

Oct 21, 2011 at 4:49 PM

thanks  very much the rrror got vanished,................. really  how  stupid  iam ..............

Oct 21, 2011 at 4:54 PM

problem  solved thanks  very much  for immediate support, your  are really gr8

Oct 24, 2011 at 12:00 PM

iam working on change password.iam using below code to change password its  working but  its showing System.Web.UI.WebControls.TextBox in the database. hoe to solve it


 MembershipUser currentUser = Utils.getUser(UserName);


Oldpassword = currentUser.GetPassword();



MembershipProvider provider = Membership.providet;





output.Visible =



output.Text +=

"<BR> Password is changed"




response = provider.ChangePassword(username, Oldpassword, newpassword.ToString());



Oct 24, 2011 at 12:55 PM

got it worked....