Book Image

ASP.NET 4 Social Networking

By : Atul Gupta, Sudhanshu Hate, Andrew Siemer
Book Image

ASP.NET 4 Social Networking

By: Atul Gupta, Sudhanshu Hate, Andrew Siemer

Overview of this book

<p>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.<br /><br />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.<br /><br />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.</p> <p>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.</p>
Table of Contents (23 chapters)
ASP.NET 4 Social Networking
Credits
About the Authors
Acknowledgement
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Social networking has become a driving force on the Internet. Many people are part of at least one social network, while more often people are members of many different communities. For this reason many business people are trying to capitalize on this movement and are in a rush to put up their own social network. As the growth of social networks continues, we have started to see more and more niche communities popping up all over in favor of the larger, all-encompassing networks in an attempt to capture a sliver of the market.

In this book, we will discuss the many aspects and features of what makes up the majority of today's social networks or online communities. Not only will we discuss the features, their purpose, and how to go about building them, but we will also take a look at the construction of these features from a large scale enterprise perspective. The goal is to discuss the creation of a community in a scalable fashion.

What this book covers

Chapter 1, Social Networking gives you an overall structure of this book, that is, what a reader can expect from this book.

Chapter 2, An Enterprise Approach to our Community Framework helps you create an enterprise framework to handle the needs of most web applications. It discusses design patterns, best practices, and certain tools to make things easier. It also covers error handling and logging.

Chapter 3, User Accounts covers registration and account creation process by means of an email verification system and a permission system to ensure security. It also touches upon password encryption/decryption techniques.

Chapter 4, User Profiles covers the creation of a user's profile and an avatar in a manner that is flexible enough for all systems to use. In this chapter, we also implement some form of privacy to allow users to hide parts of their profile that they don't want to share with others.

Chapter 5, Friends shows you how to implement friends, how to search for them, find them in the site's listings, and import your contacts into the site to find your friends.

Chapter 6, Messaging helps you create a messaging system that will resemble a web-based email application similar to Hotmail or Gmail. We will also learn how to implement the Xinha WYSIWYG editor in a way that can be re-used easily across the site for complex inputs.

Chapter 7, Media Galleries covers details on how to build a generic media management system that will allow you to host video, photos, resumes, or any number of physical files with minimal tweaking. It also addresses the issue of multi-file uploads via RIA technologies like Flash and Silverlight.

Chapter 8, Blogs is all about Blogging. With search engines, users, and security in mind, we invest a part of this chapter to address an issue that plagues many dynamic websites—query string data being used to determine page output.

Chapter 9, Forums discusses the creation of the core features of a discussion forum—categories, forums, threads, and posts. Along with these features, the chapter also extends the friendly URLs concept to make our content more suitable for search engine optimization.

Chapter 10, Groups covers the concept of Groups. It focuses on how groups can be used to bring many different systems together in a way to start creation of sub-communities.

Chapter 11, User Interactivity helps us build controls to allow our users to express their opinions about various content areas of our site—tagging, rating, commenting, voting and mark as answer. It also discusses how these in turn allow users to earn medals and hence reputation on the site.

Chapter 12, Moderation focuses on Moderation, that is, the means to manage community provided content using a very simple flagging tool. It also covers methods such as Gagging to deal with habitual rule breakers. It also takes a look at how to filter specific words from content on the site.

Chapter 13, Scaling discusses some concepts to help you support a large number of users on your social network. It starts by looking at some key concepts of tiered architecture and web farming. It also discusses ways to create and search indexed data, methods to optimize data retrieval and content creation, and some mail queuing concepts.

Appendix covers a discussion on the Microsoft ASP.NET MVP and MVC patterns and explains why we continued to use the MVP pattern for this book.

What you need for this book

This book describes how to build a Social Network using Microsoft ASP.NET 4, Microsoft C# 4, and Microsoft SQL Server 2008. To use this book effectively, you will need access to Microsoft Visual Studio 2010 and Microsoft SQL Server 2008. Most of this book can be used with the various Express editions of Microsoft Visual Studio 2010 and SQL Express, but you will find that having the Professional edition of Microsoft Visual Studio 2010 will make your work flow more efficient. As we are not just discussing Microsoft ASP.NET, but are instead more interested in what is needed for the features of social networking, there may be times when we turn to an open source solution. All the examples in this book will clearly point out where to get the needed software, and how to configure that software as we work through our examples.

Who is this book for

This book is written for Microsoft ASP.NET and C# developers who want to build an enterprise-grade Social Network, either for their own business purposes or as a contract job for another company. The book assumes you have prior experience of developing web applications using Microsoft ASP.NET 4, Microsoft C# 4, Microsoft SQL Server 2008, and Microsoft Visual Studio 2010; it focuses on topics that will be of interest to existing developers—not on providing step-by-step examples for each detail.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Create a new class in the Fisharoo/BusinessLogic directory called ProfileService."

A block of code will be set as follows:

if (profile != null && profile.ProfileID > 0)
{
attributes = _profileAttributeService. GetProfileAttributesByProfileID (profile.ProfileID);
levelOfExperienceType =
_levelOfExperienceTypeRepository. GetLevelOfExperienceTypeByID (profile.LevelOfExperienceTypeID);
profile.Attributes = attributes;
profile.LevelOfExperienceType = levelOfExperienceType;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:

Account account = _accountService.GetAccountByID(AccountID);
Profile profile = _profileService.LoadProfileByAccountID(AccountID);
if(profile != null)
{
account.Profile = profile;
}

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this:

"Click the Test Connection button to see if your settings are acceptable."

Note

Warnings or important notes appear in a box like this

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you have purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata are added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide the location address or website name immediately so we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with some aspect of the book, and we will do our best to address it.