You are previewing ASP.NET 4 Social Networking.
O'Reilly logo
ASP.NET 4 Social Networking

Book Description

A truly hands-on book for ASP.NET 4 Developers

  • Create a full-featured, enterprise-grade social network using ASP.NET 4.0

  • Learn key new ASP.NET and .NET Framework concepts like Managed Extensibility Framework (MEF), Entity Framework 4.0, LINQ, AJAX, C# 4.0, ASP.NET Routing,n-tier architectures, and MVP in a practical, hands-on way.

  • Build friends lists, messaging systems, user profiles, blogs, forums, groups, and more

  • A practical guide full of step by step explanations, interesting examples, and practical advice

  • In Detail

    Social Networking is all about developing connections or ties between friends and associates. While people have always networked with one another the Internet has allowed us to network with people all over the world easily. Any interest or cause can support its own social network, where fans and followers can meet, chat, and share their views. But building a social networking site from scratch involves some complex logic, and some serious coding.

    This book shows how to build a scalable, enterprise-ready social network using ASP.NET. The book uses the latest features of ASP.NET 4.0 and .NET Framework 4.0 to provide a platform that is efficient, easy to maintain, and extensible. Whether you want to build your own social network, are developing a social site for a customer or employer, or just want a practical guide to developing complex ASP.NET applications, this book is ideal for you.

    The book starts by planning the essential features of your social network, and then building a 'community framework' that will give your site a solid foundation and enable you to add all your social networking features. You can then go on to create user accounts, profile pages, messaging systems, 'friend' relationships between members, photo galleries, blogs, forums, groups, and more. Along the way you will see MEF, Entity Framework, LINQ, AJAX, C# 4.0, ASP.NET Routing,and other features of ASP.NET 4.0 put to practical and interesting uses. There is also integration with other technologies like Silverlight, Flash, XINHA WYSIWYG editor, reCaptcha, Lucene.NET and Cropper and you also look at custom implementation of authentication and profile features for the website.

    This book will show you how to create a scalable, maintainable social network that can support hundreds of thousands of users, complete with multimedia features.

    A step by step guide to building enterprise-ready social networking and community applications with ASP.NET 4

    Table of Contents

    1. ASP.NET 4 Social Networking
      1. ASP.NET 4 Social Networking
      2. Credits
      3. About the Authors
      4. Acknowledgement
      5. Acknowledgement
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who is this book for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code for the book
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Social Networking
        1. What makes this topic so important
          1. Communities Galore
        2. Once I have my own social network, then what?
          1. Customer service
          2. Content moderation
          3. Growing infrastructure requirements
          4. POST and SLATES
        3. Our social network—Fisharoo
        4. This book's approach
          1. Problem
          2. Design
          3. Solution
        5. Features of our social network
          1. Accounts
          2. Profiles
          3. Friends
          4. Messaging
          5. Media galleries
          6. Blogging
          7. Forums
          8. Groups
          9. Comments
          10. Tags
          11. Ratings
          12. Mark as Answer
          13. Voting
          14. Medals
          15. Framework
          16. Scaling up
        6. Summary
      10. 2. An Enterprise Approach to our Community Framework
        1. Application design
          1. Key principles
          2. Layered architecture
            1. Layers
          3. Tiered architecture
        2. Domain-driven Design
          1. Important aspects
            1. Ubiquitous language
            2. Entities
            3. Value objects
            4. Services
            5. Modules
            6. Aggregates
            7. Factories
            8. Repositories
        3. Entity Framework
        4. Repository pattern and Entity Framework
        5. Building Extensibility using Managed Extensibility Framework (MEF)
        6. Model View Presenter pattern
          1. Model
          2. View
          3. Presenter
          4. How it works
        7. Creating the .NET Solution
          1. Presentation layer
          2. Components layer
            1. Configuration
            2. Cache
            3. Session
            4. Redirection
            5. Email
            6. Error handling and logging
              1. Logging
              2. Error handling
          3. Data Access layer
        8. Summary
      11. 3. User Accounts
        1. Problem
        2. Design
          1. Registration
            1. Accounts
            2. Password strength
            3. Terms and conditions
            4. reCAPTCHA
            5. Email confirmation and verification
          2. Security
            1. Permissions
            2. Password encryption/decryption
          3. Logging in
            1. Password reminder
            2. Manage account
        3. Solution
          1. Implementing the database
            1. The Accounts table
            2. The Permissions table
            3. The AccountPermissions table
            4. The Terms table
            5. Creating the relationships
          2. Implementing the data access layer
            1. Update Model from Database
            2. A Data Context wrapper
            3. Building repositories
              1. Selecting accounts
              2. Saving an account
              3. Deleting an account
              4. Adding permissions to an account
            4. The other repositories
              1. Permissions repository
              2. Terms repository
          3. Implementing the application layer
            1. Extension methods
          4. Implementing the domain layer
          5. Implementing the presentation layer
            1. Model view presenter
              1. View
              2. Presenter
            2. Registration page
            3. Email verification
            4. Password recovery
            5. Edit account
            6. Implementing security
              1. SiteMap
              2. SiteMap wrapper
              3. All nodes
              4. Navigation
              5. Checking access
              6. Security
              7. Implementing navigation and security
        4. Summary
      12. 4. User Profiles
        1. Problem
        2. Design
          1. Profile
            1. Manage profile
          2. Avatar
            1. Custom avatars
            2. Gravatar
          3. Public profile
            1. Custom homepage
          4. Privacy
          5. News feed
        3. Solution
            1. Revisiting the Solution Structure
          1. Implementing the database
            1. The Profiles table
            2. Level of experience
            3. The Attributes table
            4. The Privacy table
            5. The Alerts table
          2. Setting up the data access layer
            1. Entity classes
            2. Building repositories
          3. Implementing the services/application layer
            1. ProfileService
            2. Account service
            3. Privacy service
            4. Alert service
            5. Other services
          4. Implementing the presentation layer
            1. Privacy
              1. Manage privacy
            2. Manage profile
            3. Avatar
              1. Upload avatar
              2. Image manipulation
              3. Gravatar
            4. Public profile
              1. Custom homepage
            5. News feed/Alerts
        4. Summary
      13. 5. Friends
        1. Problem
        2. Design
          1. Friends
          2. Finding friends
            1. Searching for a friend
            2. Inviting a friend
            3. Importing friends from external sources
            4. Sending an invitation
            5. Adding friend alerts
          3. Interacting with your friends
            1. Viewing your friends
            2. Managing your friends
            3. Following your friends
            4. Providing status updates to your friends
        3. Solution
          1. Implementing the database
            1. The friends table
            2. Friend invitations
            3. Status updates
            4. Creating the relationships
          2. Setting up the data access layer
            1. Building repositories
              1. FriendRepository
              2. FriendInvitationRepository
              3. StatusUpdateRepository
              4. AccountRepository
            2. FriendService
            3. AlertService
            4. PrivacyService
          3. Implementing the Presentation layer
            1. Searching for friends
              1. SiteMaster
              2. Search
            2. Invite your friends
            3. Outlook CSV importer
              1. Importing contacts
              2. Selecting contacts
            4. Confirm friendship
              1. Login
              2. Registration
            5. Show friends
            6. Friends on profile
            7. Status updates
        4. Summary
      14. 6. Messaging
        1. Problem
        2. Design
          1. Messages
          2. Recipients
        3. Solution
          1. Implementing the database
            1. Messages
              1. MessageTypes
            2. MessageRecipients
              1. MessageRecipientTypes
              2. MessageStatusTypes
              3. MessageFolders
            3. Creating the relationships
          2. Setting up the data access layer
            1. Building repositories
              1. MessageRepository
              2. MessageRecipientRepository
          3. Implementing the services/application layer
            1. MessageService
            2. Email
            3. AlertService
            4. FriendService
          4. Implementing the presentation layer
            1. New message
              1. Friends control
            2. Default (or Inbox)
              1. Folders
            3. Read message
        4. Summary
      15. 7. Media Galleries
        1. Problem
          1. Design
          2. Files
          3. Folders
          4. File upload
          5. File system management
          6. Data management screens
        2. Solution
          1. Implementing the database
            1. Files
            2. File system folders
            3. File types
            4. Folders
            5. Folder types
            6. Account folders
            7. Account files
            8. Folder files
            9. Creating the relationships
          2. Setting up the data access layer
            1. Building repositories
              1. FileRepository
              2. FolderRepository
          3. Implementing the services/application layer
            1. FolderService
          4. Implementing the presentation layer
            1. File upload
              1. Multiple file upload
              2. Receiving files with Silverlight uploader
            2. Photo albums
              1. MyPhotos
              2. ViewAlbum
        3. Summary
      16. 8. Blogs
        1. Problem
        2. Design
          1. Blogs
          2. Solution
          3. Implementing the database
            1. Blogs
            2. Creating the relationships
          4. Setting up the data access layer
          5. Building repositories
          6. Implementing the services/application layer
            1. AlertService
          7. Implementing the presentation layer
            1. Latest blog posts
            2. My Blogs
            3. Fancy URL support
            4. View post
            5. Create or edit post
        3. Summary
      17. 9. Forums
        1. Problem
        2. Design
        3. Categories
          1. Forums
          2. Threads and posts
          3. Friendly URLs
          4. Alerts
        4. Solution
          1. Implementing the database
            1. Categories
            2. Forums
            3. Posts
            4. Creating the relationships
          2. Setting up the data access layer
            1. Building repositories
              1. BoardCategoryRepository
              2. BoardForumRepository
              3. BoardPostRepository
          3. Implementing the Services/Application layer
            1. BoardService
            2. AlertService
          4. Implementing the Presentation layer
            1. Default.aspx
            2. URL routing
            3. ViewForum.aspx
            4. ViewPost.aspx
            5. Post.aspx
        5. Summary
      18. 10. Groups
        1. Problem
        2. Design
          1. Groups
          2. GroupMembers
          3. GroupTypes
          4. GroupForums
        3. Solution
          1. Implementing the database
          2. Groups
            1. GroupMembers
            2. GroupTypes
            3. GroupForums
            4. Creating the relationships
          3. Setting up the data access layer
            1. Building repositories
            2. GroupRepository
              1. GetGroupByForumID
              2. IsOwner
              3. CheckIfGroupPageNameExists
            3. GroupToGroupTypeRepository
              1. SaveGroupTypesForGroup
            4. GroupForumRepository
            5. GroupMemberRepository
              1. GetMemberAccountIDsByGroupID
              2. DeleteGroupMembers
            6. GroupTypeRepository
            7. AccountRepository
              1. GetApprovedAccountsByGroupID
            8. GetAccountsToApproveByGroupID
          4. Implementing the services/application layer
            1. GroupService
              1. IsOwnerOrAdministrator
              2. SaveGroup
            2. AlertService
            3. Redirector
            4. WebContext
          5. Implementing the presentation layer
            1. ManageGroup
              1. WYSIWYG
              2. Image upload
            2. Members
              1. Data pagination
              2. CheckBoxLists without the CheckBoxList control
            3. Default
            4. URL routing
            5. ViewGroup
              1. Private/Public
            6. MyGroups
            7. Forum enhancements
        4. Summary
      19. 11. User Interactivity
        1. Problem
          1. Ratings
          2. Tagging
          3. Commenting
          4. Mark as answer
          5. Voting
          6. Medals
        2. Design
          1. Ratings
          2. Tags
          3. Comments
          4. Voting
          5. Medals
        3. Solution
          1. Implementing the database
            1. SystemObjects
            2. Ratings
            3. System object rating options
            4. Tags
            5. System object tags
            6. Comments
            7. Votes and Mark as Answer
            8. Medals
            9. Creating the relationships
          2. Setting up the data access layer
            1. Building repositories
            2. RatingRepository
              1. HasRatedBefore()
              2. GetCurrentRating()
              3. SaveRatings()
            3. SystemObjectRatingOptionRepository
            4. TagsRepository
              1. GetTagByName()
              2. GetTagsGlobal()
              3. GetTagsBySystemObject()
              4. GetTagsBySystemObjectAndRecordID()
            5. SystemObjectTagRepository
              1. GetSystemObjectByTagID()
            6. CommentRepository
            7. BoardPost Repository
          3. Implementing the services/application layer
            1. TagService
              1. AddTag()
              2. CalculateFontSize()
            2. Extensions
            3. AccountService
              1. SaveAccount ()
            4. WebContext
              1. SelectedRatings
              2. ClearSelectedRatings
            5. Configuration
          4. Implementing the presentation layer
            1. Comments Page
              1. Comments.ascx
              2. Comments.ascx.cs
              3. CommentsPresenter.cs
            2. Ratings Page
              1. Ratings.ascx
              2. Ratings.ascx.cs
              3. RatingsPresenter.cs
            3. Tags Page
              1. Tags.ascx
              2. Tags.ascx.cs
              3. TagsPresenter.cs
            4. Votes page
              1. Votes.ascx
              2. Votes.ascx.cs
              3. VotesPresenter.cs
            5. MarkAnswer page
              1. MarkAnswer.ascx
              2. MarkAnswer.ascx.cs
              3. MarkAnswerPresenter.cs
            6. Medals page
              1. Medals.ascx
              2. Medals.ascx.cs
            7. Installing the new user controls
              1. Photos UI
              2. Forums UI
              3. ProfileDisplay UserControl
            8. Tags page
              1. Tags.aspx
              2. Tags.aspx.cs
              3. TagsPresenter.cs
        4. Summary
      20. 12. Moderation
        1. Problem
          1. Community moderation
          2. Gagging users
          3. Dynamic filter
          4. Design
          5. Moderation
          6. Gags
          7. Filtering
        2. Solution
          1. Implementing the database
          2. Moderations
            1. Gags
            2. ContentFilters
            3. Creating the relationships
          3. Setting up the data access layer
            1. Building repositories
              1. ModerationRepository
                1. GetModerationsGlobal()
              2. GagRepository
              3. ContentFilterRepository
          4. Implementing the services/application layer
            1. ContentFilterService
          5. Implementing the presentation layer
            1. Moderation
              1. The user control
              2. Moderating flagged content
            2. Gagging
            3. Filtering
        3. Summary
      21. 13. Scaling
        1. Problem
        2. Design
        3. Solution
          1. Tiered architecture
            1. Scaling with two-tiered approach
            2. Scaling with multi-tiered approach
          2. Presentation and application tier scaling
            1. Layered architecture validation
            2. Service enabling business logic
              1. Web Server and application server—Windows IIS 7.5 and AppFabric
          3. Web farming
          4. Caching
            1. Caching—AppFabric solution
              1. Client
            2. Caching—MemCached solution
              1. The server
              2. The client
              3. Using the client
              4. Caching in the Business logic layer
            3. Configuration
            4. Where do I start?
          5. Email
            1. Creating services to send email
            2. The database
            3. Services
            4. Serializing email
            5. Connecting the new DBMailQueueService
            6. The queue
            7. Processing the queue
          6. Alerts
          7. Database tier scaling
            1. Flagged for delete
            2. Indexing
            3. Partitioning
              1. FileGroups
              2. Partition function
              3. Partition scheme
              4. Partition tables
              5. How does this affect our current system?
            4. Gotchas
          8. Searching
            1. Getting Lucene.NET
            2. Building indexes
            3. Building the search
        4. Summary
      22. A. Comparing ASP.NET MVP with ASP.NET MVC
        1. ASP.NET Web Forms
          1. Web presentation patterns
            1. Page cache
            2. Page controller
            3. Model view presenter
            4. Model view controller
            5. Front controller
            6. Intercepting filter
        2. ASP.NET MVC
        3. Choosing between MVP and MVC
        4. Summary