Social Networking Website - Friends.Com free asp.net project with source codes
This website allows users to register, add other members
as friends and create and join communitites. It provides scrapbook for
each user and other typical features like change profile, change password etc.
The following are major activities in this application.
- User registration
- Login
- Change password
- Forgot password
- Edit profile
- Change photo
- Search for Friends
- Add a user as friends
- Viewing scrapbook
- Sending message to other user
- Creating communities
- Search for communities
- Joinging other communities
Technologies and Products Used
- ASP.NET 3.5
- C# language
- Visual Studio.NET 2008
- SQL Server 2005 Express Edition
- ADO.NET
- Login controls - Membership
- Stored procedures and trigger
- Master pages and Themes
- Gridview, DetailsView, FormView, DataList and SqlDataSource controls
- ListView control
Steps to download, deploy and run this project
The following are the steps to related to be taken to run the existing
part of the application. This
project makes use of membership feature of ASP.NET.So, we have to
configure the website using ASP.NET Configuration tool as explained
below.
- Download friends.zip and unzip it into any directory in your system.
For example, if you extract to c:\ then it will create a directory c:\friends.
The download contains all ASP.NET pages but it has NO DATABASE. We have to create database objects using
ASP.NET configuration tool manually.
- Open Visual Studio.NET 2008 or Visual Web Developer 2008.
- Open the project from the directory into which you extracted project.For example,
c:\friends
- Select Website->ASP.NET Configuration option
- Select Security tab
- Select Use the security Setup Wizard to configure security step by step.
- Select From Internet option in Step 2
- Click on Next button in the remaining screens and finally click on Finish.
- It create a database called ASPNETDB.MDF with required tables and other database components
- Open the database in Server explorer
or Database Explorer and create tables - USER_PROFILE, COMMUNITIES,
COMMUNITY_USERS, FRIENDS and SCRAPBOOK. The structure is shown in the
picture below. ASPNET_USERS table
is already created by ASP.NET. The rest of the tables are to be created.
Column MSGID in SCRAPBOOK and
COMMID in COMMUNITIES are identity columns.
- While creating table make sure you define Foreign keys as follows.
Child Table and Foregin Key |
Parent Table and Parent Key |
USER_PROFILE - USERID |
ASPNET_USERS - USERID |
FRIENDS - USERID |
ASPNET_USERS - USERID |
FRIENDS - FRIENDID |
ASPNET_USERS - USERID |
SCRAPBOOK - SENDERID |
ASPNET_USERS - USERID |
SCRAPBOOK - RECEIVERID |
ASPNET_USERS - USERID |
COMMUNITIES - OWNERID |
ASPNET_USERS - USERID |
COMMUNITY_USERS - USERID |
ASPNET_USERS - USERID |
COMMUNITY_USERS - COMMID |
COMMUNITIES - COMMID |
-
Create the following triggers and stored procedure in the database.
CREATE TRIGGER Trg_insert_row_into_user_profile
ON dbo.aspnet_Users
FOR INSERT
AS
declare @userid uniqueidentifier
select @userid = userid from inserted
insert into user_profile
values( @userid, null,null,null,null)
CREATE PROCEDURE dbo.DeleteCommunity(@commid int)
AS
begin tran
delete from community_users where commid = @commid;
delete from communities where commid = @commid;
commit tran
CREATE PROCEDURE dbo.GetFriends(@userid as varchar(50))
AS
select u.userid,u.username,fullname
from aspnet_users u join user_profile up
on u.userid = up.userid
where u.userid in (
select friendid from friends
where userid = convert(uniqueidentifier,@userid) );
CREATE PROCEDURE dbo.GetMessages(@userid as varchar(50))
AS
select msgid,userid,username, message, senton
from aspnet_users u join scrapbook s
on u.userid = s.senderid
where s.receiverid = @userid
CREATE PROCEDURE dbo.GetUserDetails(@userid varchar(50))
AS
select u.userid, username, fullname, occupation,
gender = case gender
when 'm' then 'Male'
else 'Female'
end,
dob = convert(varchar(10), dob, 3)
from user_profile up join aspnet_users u
on up.userid = u.userid
where u.userid = convert(uniqueidentifier,@userid);
CREATE PROCEDURE dbo.SearchFriends(@name as varchar(30))
AS
select u.userid,username,fullname
from aspnet_users u join user_profile up
on u.userid = up.userid
where username like '%' + @name + '%'
or fullname like '%' + @name + '%';
CREATE PROCEDURE dbo.SendMessage(@fromuserid uniqueidentifier,@touserid uniqueidentifier,
@text varchar(2000) )
AS
insert into scrapbook
values(@fromuserid,@touserid,@text,getdate());
- Goto Solution Explorer and make login.aspx the startup page.
- Run project from Visual Studio.NET 2008 or Visual Web Developer 2008.
- You should see login.aspx page.