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

2 Answers 2


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



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!


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


  • 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, 2013 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 Jafer
    Apr 30, 2013 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, 2013 at 11:05

try the new ASP.Net Identity Introduction to ASP.NET Identity and Customizing User's Profile to add new fields in brand new database table here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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