Tuesday, 12 August 2014

Social Networking Website - Friends.Com free asp.net project with source codes

Advertisement

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.
  1. 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.
  2. Open Visual Studio.NET 2008 or Visual Web Developer 2008.
  3. Open the project from the directory into which you extracted project.For example, c:\friends
  4. Select Website->ASP.NET Configuration option
  5. Select Security tab
  6. Select Use the security Setup Wizard to configure security step by step.
  7. Select From Internet option in Step 2
  8. Click on Next button in the remaining screens and finally click on Finish.
  9. It create a database called ASPNETDB.MDF with required tables and other database components
  10. 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.
  11. While creating table make sure you define Foreign keys as follows.
    Child Table and Foregin KeyParent Table and Parent Key
    USER_PROFILE - USERIDASPNET_USERS - USERID
    FRIENDS - USERIDASPNET_USERS - USERID
    FRIENDS - FRIENDIDASPNET_USERS - USERID
    SCRAPBOOK - SENDERIDASPNET_USERS - USERID
    SCRAPBOOK - RECEIVERIDASPNET_USERS - USERID
    COMMUNITIES - OWNERIDASPNET_USERS - USERID
    COMMUNITY_USERS - USERIDASPNET_USERS - USERID
    COMMUNITY_USERS - COMMIDCOMMUNITIES - COMMID
  12. 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());

  13. Goto Solution Explorer and make login.aspx the startup page.
  14. Run project from Visual Studio.NET 2008 or Visual Web Developer 2008.
  15. You should see login.aspx page.


EmoticonEmoticon