Skip Navigation Links


FB Connect and ASP.Net Membership

Integrating Facebook Connect to your exsting ASP.Net service

Hello, time is flying by and 2009 is almost over! I have spent fair amount of time developing Facebook Application this year, and still planing to spend more time on it. Facebook is ever growing service now and it is great opportunity for all web service to be a part of it. IMO, it takes lots of integration to be successful, there are millions of application written and only few can be successful. First, you ll have to spend some to thinking about how to integrate your service into Facebook. If you already have existing web service you ll probably run into to Facebook Connect as a part of solution. In several notes, I am going to write about how to integrate Facebook Connect to existing ASP.Net service Membership and Role Management.

As always, before getting into the main topic, I m leaving reference notes that ll be useful.

When building registered user base service, it's very important that you understand how Membership and Role Management work in ASP.Net

Membership and Role Management Service is great way to control accesses of your web application using Microsoft SQL Server.

Membership and Role Management Service comes in two group, Server Controls and API. And it work with SQL (or other data stores) through Membership Providers. We will get to the Membership Providers later, but let's just say Membership and Role Management provide following API. I assume reader of this blog already have fair amount of knowledge.

Here is note for Membership API methods available.

CreateUser

-Add a new user to the appointed data store.

DeleteUser

-Deletes a specified user from the data store.

FindUsersByEmail

-Returns a collection of users who have an e-mail address to match the one provided.

FindUsersByName

-Returns a collection of users who have a username to match the one provided.

GeneratePassword

-Generates a random password of a length that you specify.

GetAllUsers

-Returns a collection of all the users contained in the data store.

GetNumberOfUsersOnline

-Returns an Integer that specifies the number of users who have logged in to the application. The time window during which users a re counted is specified in the machine.config or the web.config files.

GetUser

-Returns information about particular user from the data store.

GetUserNameByEmail

-Retrieves a username of a specific record from the data store based on an email address search.

UpdateUser

-Update a particular user's information in the data store.

ValidatUser

-Returns a Boolean value indicating whether a specified set of credential valid.

And here is note for Roles API

AddUsersToRole

-Adds a collection of users to a specific roles.

AddUsersToRoles

-Adds a collection of users to a collection of roles.

AddUserToRole

-Adds a specific user to a collection of roles.

CreateRole

-Adds a new role to the appointed data store.

DeleteCookie

-Deletes the cookie on the client used to store the roles to which the user belongs.

DeleteRole

-Deletes a specific role in the data store. Using the proper parameters for this method, you can also control if roles are deleted or kept intact or not that particular role contains users.

FindUsersInRole

-Returns a collection of users who have a username to match the one provided.

GetAllRoles

-Returns a collection of all the roles stored in the data store.

GetRolesFroUser

-Returns a collection of roles for a specific user.

IsUserInRole

-Returns a Boolean value that specifies whether a user is contained in a particular role.

RemoveUserFromRole

-Remove a specific user from a specific role.

RemoveUserFromRoles

-Removes a specific user from a collection of roles.

RemoveUsersFromRole

-Removes a collection of users from a specific role.

RemoveUsersFromRoles

-Removes a collection of users from a collection of roles.

RoleExists

-Returns a Boolean value indicating whether a role exists in the data store.

Why did I leave these notes here? Because with Facebook Connect we will need to accept authentication from Facebook and we will also need to authenticate at ASP.Net membership. Users who has logged in via Facebook Connect should probably belong to role called Facebook users and display appropriate messages.

Let's look in how we can integrate ASP.Net Membership and Role Management Service with Facebook Connect.

Tag: Facebook Connect
By: syantien | 12/30/2009 11:11:58 AM / 12/30/2009 11:18:00 AM

Comment

waing for next

From: JJ
Hi, I am thinking about using Facebook Connect too, I am waiting for your next post.
Updated: 12/30/2009 11:19:39 AM



Comment

Name
 

Title

Email

Comment
 

Your IP Address is: 38.107.191.84

* to keep comments safe and clean, we display and keep your ip address.