Introduction

It was estimated in June 2015 that 45 percent of the world's population has accessed the Internet. That's over 3 billion users, and the number is growing every day. This is a vast, connected market that can reach any content you decide to make available, be it a simple web page or a complex web application.

There are a lot of ways that you can make a simple web page available online. There are a lot fewer approaches when you are trying to build a web application. One of these web application technologies is ASP.NET from Microsoft.

ASP.NET is a framework that supports the building of robust and performant web applications. Think of it as the structural support for a car. You can add a couple of different body designs on top of this structure: ASP.NET Web Forms and ASP.NET MVC. These two approaches both rest on ASP.NET and depend on common functionality that is made available through ASP.NET.

Visual Studio 2015 is the primary tool used when creating and maintaining ASP.NET web applications. It will help you easily work with every aspect of your web application, from the “look and feel” all the way through to deployment of your application—and skipping none of the steps in between. In addition, because Microsoft is committed to supporting ASP.NET developers, it is available in a fully functional free version!

This book is an exploration of both ASP.NET Web Forms and MVC. As part of this exploration you will become familiar with all of the various components of a functional web application, creating a sample application as you go through the different parts of the development process. You will learn how the two frameworks do things, with some approaches being very similar while others are completely different. No matter the style of approach, however, it is always clear that they both rest on the same framework.

Who This Book Is For

This book is designed for anyone who wants to build robust, performant, and scalable web applications. Although the development tools run in Microsoft Windows, you are free to deploy the application onto virtually any current operating system; therefore, even organizations that don't have Microsoft servers have the capability to now run ASP.NET web applications.

If you are new to software development you should have no problem following along, as the book has been structured with you in mind. Those of you who are experienced developers but new to web development will also find many different areas of interest and use, especially if C# is not your current programming language.

Lastly, experienced ASP.NET developers should also find many topics of interest, especially if your experience is mainly related to either Web Forms or MVC, but not both. This book will give you experience in both approaches as well as demonstrate how to integrate the two approaches into a single application.

What This Book Covers

This book teaches you how to build a fully functional web application. You will have the opportunity to build a complete site using both ASP.NET MVC and ASP.NET Web Forms approaches so that you can develop an understanding of, and build a comfort level with, the complete ASP.NET set of functionality. Each chapter takes you a step further along the development process:

  • Chapter 1: Getting Started with ASP.NET 6.0—You will get an introduction to ASP.NET as a general framework and specifically with Web Forms and MVC. You will also download and install Visual Studio 2015.
  • Chapter 2: Building an Initial ASP.NET Application—In this chapter you create the initial project, including configuring it to support both Web Forms and MVC.
  • Chapter 3: Designing Your Web Pages—This chapter introduces you to HTML and CSS so that you can build attractive and understandable web sites.
  • Chapter 4: Programming in C# and VB.NET—ASP.NET is a developmental framework with which you can use different programming languages, including C# and VB.NET. This chapter provides an introduction to using them.
  • Chapter 5: ASP.NET Web Form Server Controls—ASP.NET Web Forms offers many different forms of built-in functionality that it provides as server controls. These controls enable you to create complex and feature-rich web sites with very little code. This chapter covers the most common controls.
  • Chapter 6: ASP.NET MVC Helpers and Extensions—Whereas ASP.NET Web Forms have server controls to provide features, ASP.NET MVC offers a different type of support through the use of helpers and extensions. This chapter describes that different support.
  • Chapter 7: Creating Consistent-Looking Websites—You will learn how ASP.NET enables you to use master pages and layout pages to create a consistent look and feel throughout your web application.
  • Chapter 8: Navigation—In this chapter you learn the different ways to create menus and other navigation structures. You also look at the different types of links that you can build in both Web Forms and MVC.
  • Chapter 9: Displaying and Updating Data—When you want to use a database with ASP.NET, there are no better options than SQL Server. In this chapter, you install SQL Server, create your initial database schema, and incorporate the creation and display of data into your application.
  • Chapter 10: Working with DataAdvanced Topics—Advanced topics include pagination, sorting, and using advanced database items such as stored procedures to retrieve special sets of information from the database. You will also learn how you can speed up responsiveness by storing data in various places.
  • Chapter 11: User Controls and Partial Views—ASP.NET offers server controls and helpers to provide built-in functionality. Learn how to create your own items to provide common functionality across multiple pages.
  • Chapter 12: Validating User Input—A large part of your site's functionality is defined by the data that users input into your application. This chapter shows you how to accept, validate, and process user input using tools for both Web Forms and MVC.
  • Chapter 13: ASP.NET AJAX—AJAX is a technology that enables you to update parts of your page without making a full-page call to the server. Learn how to do this for both Web Forms and MVC.
  • Chapter 14: jQuery—Everything covered up until this point has been based on doing work on the server. In this chapter you are introduced to using jQuery for work on the client, without having to call back to the server.
  • Chapter 15: Security in Your ASP.NET Website—This chapter adds the concept of a user, demonstrating how you can identify your visitors by requiring them to log in to your application.
  • Chapter 16: Personalizing Websites—Here you will learn how to customize the user information you are using to get the information needed to ensure that users feel welcome at your site. Capturing information about the user's visit also helps you better understand what they want when they visit your site.
  • Chapter 17: Exception Handling, Debugging, and Tracing—Unfortunately, it's very difficult to write code that is totally problem-free. Learn how to manage these problems, including finding and fixing them as well as ensuring that when they happen, users are given the relevant information as to why their actions were not successful.
  • Chapter 18: Working with Source Control—Working within a team is an important aspect of being a professional developer. Source control provides a way for you to share code among users. It also manages backing up your source code with saved versions.
  • Chapter 19: Deploying Your Website—After completing all the work to build your application, the last step is getting out onto the web where your users can visit it!

How This Book Is Structured

The primary instructional approach in this book is a set of detailed hands-on steps that walk you through the process of building a complete application. These “Try It Out” activities, which demonstrate whatever topic is under discussion, are followed by a “How It Works” section that explains what each step accomplishes. Each of the “Try It Out” sections builds on what was done previously, so they should be followed sequentially.

Exercise questions at the end of the chapter enable you to test your understanding of the material, and answers are available in the appendix. Some questions are specific, others more general. Together they are designed to help reinforce the information presented in the chapter.

A lot of information is presented in this book; it covers two technological approaches that sometimes seem completely different. Additional sources of information are included in the chapters if you want more detailed information about a particular approach or product.

What You Need to Use This Book

In order to follow along with the chapter and its hands-on activities, you will need the following:

  • Windows 7, 8, or 10 or Windows Server 2008 or 2012
  • The minimum requirements for Visual Studio 2015, including RAM and hard drive space

Conventions

To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

As for styles in the text:

  • We highlight new terms and important words when we introduce them.
  • We show keyboard strokes like this: Ctrl+A.
  • We show filenames, URLs, and code within the text like so: persistence.properties.

We present code in two different ways:

We use a monofont type with no highlighting for most code examples.
We use bold to emphasize code that's particularly important in the present context.

Source Code

As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at http://www.wrox.com/go/beginningaspnetforvisualstudio. You will find the code snippets from the source code are accompanied by a download icon and note indicating the name of the program so you know it's available for download and can easily locate it in the download file. Once at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book.

After downloading the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

Errata

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful for your feedback. By sending in errata you may save another reader hours of frustration, and at the same time you will be helping us provide even higher quality information.

To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list, including links to each book's errata, is also available at www.wrox.com/misc-pages/booklist.shtml.

If you don't spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

p2p.wrox.com

For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com you will find a number of different forums that will help you not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

  1. Go to p2p.wrox.com and click the Register link.
  2. Read the terms of use and click Agree.
  3. Complete the required information to join as well as any optional information you wish to provide and click Submit.
  4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to This Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.167.196