How to use Membership Request Functionality ?

Jun 3, 2011 at 9: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

Coordinator
Jun 3, 2011 at 4: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 7:24 AM
Edited Jun 6, 2011 at 7: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.

Thanks

Coordinator
Jun 6, 2011 at 11:48 AM

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 12:08 PM

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

Coordinator
Jun 6, 2011 at 12: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 2:24 PM

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

Thanks

Coordinator
Jun 6, 2011 at 2: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 4:01 AM
Edited Jun 7, 2011 at 8: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.

Coordinator
Jun 7, 2011 at 12: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 1:07 PM

Hi

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

Thanks

Jun 8, 2011 at 10: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?

Thanks.

Coordinator
Jun 8, 2011 at 12: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 7: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.

Thanks.

Jun 9, 2011 at 12: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.

Thanks

Coordinator
Jun 9, 2011 at 3: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: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WEB.UI.WEBCONTROLS.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.

Coordinator
Jun 9, 2011 at 3: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 http://www.visigo.com/.

Aug 4, 2011 at 11:34 AM
Edited Aug 4, 2011 at 11:42 AM

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

 

 

Coordinator
Aug 4, 2011 at 12: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:

http://blogs.msdn.com/b/chunliu/archive/2010/08/21/creating-a-custom-login-page-for-fba-in-sharepoint-2010.aspx

? 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 8:53 AM

Hi,

    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

Coordinator
Aug 12, 2011 at 5:12 PM

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

http://sharepoint2010fba.codeplex.com/discussions/261249

Sep 27, 2011 at 9:29 AM
Edited Sep 27, 2011 at 9: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 10:28 AM

hi,

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

 

Coordinator
Sep 27, 2011 at 1: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:

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/7f40ff43-68b6-4ee0-bc69-496cda99c46d/

http://www.zimmergren.net/archive/2008/06/25/sharepoints-hidden-user-list-user-information-list.aspx

Sep 28, 2011 at 6:31 AM

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

 

MembershipUser

 

newUser = Membership

.GetAllUsers()[request.UserName];

 

Guid newUserId = (Guid

)newUser.ProviderUserKey;

 

String

FirstName = request.PhoneNumber;

 

String

LastName = request.CbsAccountNumber;

 

string connectionString = ConfigurationManager.ConnectionStrings["SQLConnectionString"

].ConnectionString;

 

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

;

 

using (SqlConnection myConnection = new SqlConnection

(connectionString))

{

myConnection.Open();

 

SqlCommand myCommand = new SqlCommand

(insertSql, myConnection);

myCommand.Parameters.AddWithValue(

"@UserId"

, newUserId);

myCommand.Parameters.AddWithValue(

"@FirstName"

, FirstName);

myCommand.Parameters.AddWithValue(

"@LastName"

, LastName);

myCommand.ExecuteNonQuery();

myConnection.Close();

}

Sep 28, 2011 at 6:34 AM

HI,

  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??

Coordinator
Sep 28, 2011 at 12: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 9:49 AM

hi,

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

Sep 29, 2011 at 9:54 AM

hi,

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 ??

Coordinator
Sep 29, 2011 at 1: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 5:31 AM

hi,

  yes  you are  correct,  and thanks for the suggestion.

 

Oct 11, 2011 at 9:36 AM

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

Coordinator
Oct 11, 2011 at 1: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 2:02 PM

hi,

 

  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

="CreateUserWizard1_CreatedUser"

 

 

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" >

>

Coordinator
Oct 21, 2011 at 2: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 2: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 2: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

Coordinator
Oct 21, 2011 at 2: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 2:42 PM

iam using

SPGroup ownersGroup = web1.Groups["TestFBA Owners" 

];

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

);

 

 

// ownersGroup.AddUser(spUser);

ownersGroup.Update();

 is this the correct way.

Coordinator
Oct 21, 2011 at 2: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 3:02 PM

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

Oct 21, 2011 at 3:14 PM
Edited Oct 21, 2011 at 3: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

web.Groups[

Oct 21, 2011 at 3: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

Coordinator
Oct 21, 2011 at 3: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 3:49 PM

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

Oct 21, 2011 at 3:54 PM

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

Oct 24, 2011 at 11:00 AM

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);

 string  

Oldpassword = currentUser.GetPassword();

 

 

MembershipProvider provider = Membership.providet;

 

bool

(response)

{

output.Visible =

true

;

output.Text +=

"<BR> Password is changed"

;

}

 

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

 

if

Oct 24, 2011 at 11:55 AM

got it worked....