Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have one sharepoint site in which FBA was enabled. I am trying to show all the registerd users in a grid. Along with the username and password i want to show some custom properties like company and Mobile number also. We can set custom profile properties in asp.net. How to work with sharepoint by using those profile properties. I am creating visual webpart to display all the users. In that i am writing like below,

Membership.CreateUser(username, newpassword, Email);
var profilebaseobj = ProfileBase.Create(username, true);
profilebaseobj.SetPropertyValue("Company", company);

My visual webpart looks like below. Here I am taking company name and mobile as static values, Not from database. enter image description here

When i debug, it is giving me error stating that, unable to connect the database. Should we need to specify any database here? Is there any otherway to add custom profile properties to the sharpeoint fba user? Can any one give me the solution please!!

share|improve this question

1 Answer 1

you need to make sure that you have setup your database correctly:

make sure that you put your SQL database connection string in the web.config! In the web.config, you’ll see sections for the connection string and the providers. The and sections

lastly

Membership.CreateUser

reading up on the above, it indicates that it stores the values in App_Data but it still stores the values eg username password ect within the database!

follow this tutorial for what you want to achive in sharepoint!

http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/

so you need to make sure that:

FBA is setup correctly, SQL is setup correctly, web.config is setup correctly ;)

for other reading:

Installing ASP.NET Membership services database in SQL Server Express 2008

http://weblogs.asp.net/sukumarraju/archive/2009/10/02/installing-asp-net-membership-services-database-in-sql-server-expreess.aspx

share|improve this answer
    
What you given links i done with every thing. But details are not storing in the database. I am creating createuser wizard in visual webpart. In that to access profile properties we need to write like Profile.Company="MyCompany". But Profile is not at all identifying. I included all the necessary namespaces. –  Mihir Apr 30 '13 at 9:13
    
have you setup the web.config correctly? as described in the link? as the error is saying that it cannot connect indicating either wrong credentials/connection string or you dont have it in the web.config... if you do than make sure that your database is reachable! –  ali Sharepoint Apr 30 '13 at 9:27
    
Yeah I connected correctly only. Now error is not coming. But no values are able to set for that user. If I see in DB it there are no any profile values. –  Mihir Apr 30 '13 at 11:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.