Beginning ASP.NET 4: in C# and VB

Book description

This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to build any type of web site, ranging from simple hobby-related web sites to sites you may be creating for commercial purposes.

Anyone new to web programming should be able to follow along because no prior background in web development is assumed although it helps if you do have a basic understanding of HTML and the web in general. The book starts at the very beginning of web development by showing you how to obtain and install Visual Web Developer. The chapters that follow gradually introduce you to new technologies, building on top of the knowledge gained in the previous chapters.

Do you have a strong preference for Visual Basic over C# or the other way around? Or do you think both languages are equally cool? Or maybe you haven't made up your mind yet and want to learn both languages? Either way, you'll like this book because all code examples are presented in both languages!

Even if you have some experience with prior versions of ASP.NET, you may gain a lot from this book. Although many concepts from previous versions are brought forward into ASP.NET 4, you'll discover there's a lot of new stuff to be found in this book, including an introduction to the ADO.NET Entity Framework, the inclusion of jQuery, ASP.NET AJAX, the many changes to the ASP.NET 4 Framework, and much more.

This book teaches you how to create a feature-rich, data-driven, and interactive web site called Planet Wrox. Although this is quite a mouthful, you'll find that with Visual Web Developer 2010, developing such a web site isn't as hard as it seems. You'll see the entire process of building a web site, from installing Visual Web Developer 2010 in Chapter 1 all the way up to putting your web application on a live server in Chapter 19. The book is divided into 19 chapters, each dealing with a specific subject.

Chapter 1, "Getting Started with ASP.NET 4" shows you how to obtain and install Visual Web Developer 2010. You'll get instructions for downloading and installing the free edition of Visual Web Developer 2010, called the Express edition. You are also introduced to HTML, the language behind every web page. The chapter closes with an overview of the customization options that Visual Web Developer gives you.

Chapter 2, "Building an ASP.NET Web Site" shows you how to create a new web site and how to add new elements like pages to it. Besides learning how to create a well-structured site, you also see how to use the numerous tools in Visual Web Developer to create HTML and ASP.NET pages.

Chapter 3, "Designing Your Web Pages." Visual Web Developer comes with a host of tools that allow you to create well-designed and attractive web pages. In this chapter, you see how to make good use of these tools. Additionally, you learn about CSS, the language that is used to format web pages.

Chapter 4, "Working with ASP.NET Server Controls." ASP.NET Server Controls are one of the most important concepts in ASP.NET. They allow you to create complex and feature-rich web sites with very little code. This chapter introduces you to the large number of server controls that are available, explains what they are used for, and shows you how to use them.

Chapter 5, "Programming Your ASP.NET Web Pages." Although the built-in CSS tools and the ASP.NET Server Controls can get you a long way in creating web pages, you are likely to use a programming language to enhance your pages. This chapter serves as an introduction to programming with a strong focus on programming web pages. Best of all: all the examples you see in this chapter (and the rest of the book) are in both Visual Basic and C#, so you can choose the language you like best.

Chapter 6, "Creating Consistent Looking Web Sites." ASP.NET helps you create consistent-looking pages through the use of master pages, which allow you to define the global look and feel of a page. Skins and themes help you to centralize the looks of controls and other visual elements in your site. You also see how to create a base page that helps to centralize programming code that you need on all pages in your site.

Chapter 7, "Navigation." To help your visitors find their way around your site, ASP.NET comes with a number of navigation controls. These controls are used to build the navigation structure of your site. They can be connected to your site's central site map that defines the pages in your web site. You also learn how to programmatically send users from one page to another.

Chapter 8, "User Controls." User controls are reusable page fragments that can be used in multiple web pages. As such, they are great for repeating content such as menus, banners, and so on. In this chapter, you learn how to create and use user controls and enhance them with some programmatic intelligence.

Chapter 9, "Validating User Input." A large part of interactivity in your site is defined by the input of your users. This chapter shows you how to accept, validate, and process user input using ASP.NET Server Controls. Additionally, you see how to send e-mail from your ASP.NET web application and how to read from text files.

Chapter 10, "ASP.NET AJAX." Microsoft ASP.NET AJAX allows you to create good-looking, flicker-free web pages that close the gap between traditional desktop applications and web applications. In this chapter you learn how to use the built-in Ajax features to enhance the presence of your web pages, resulting in a smoother interaction with the web site.

Chapter 11, "jQuery." jQuery is a popular, open source and cross-browser JavaScript library designed to make it easier to interact with web pages in the client's browser. In this chapter you learn the basics of jQuery and see how to add rich visual effects and animations to your web pages.

Chapter 12, "Introducing Databases." Understanding how to use a database is critical to building web sites, as most modern web sites require the use of a database. You'll learn the basics of SQL, the query language that allows you to access and alter data in a database. In addition, you are introduced to the database tools found in Visual Web Developer that help you create and manage your SQL Server databases.

Chapter 13, "Displaying and Updating Data." Building on the knowledge you gained in the previous chapter, this chapter shows you how to use the ASP.NET data-bound and data source controls to create a rich interface that enables your users to interact with the data in the database that these controls target.

Chapter 14, "LINQ and the ADO.NET Entity Framework." LINQ is Microsoft's solution for accessing objects, databases, XML, and more. The ADO.NET Entity Framework (EF) is Microsoft's new technology for database access. This chapter shows you what LINQ is all about, how to use the visual EF designer built into Visual Studio, and how to write LINQ to EF queries to get data in and out of your SQL Server database.

Chapter 15, "Working with Data—Advanced Topics." While earlier chapters focused mostly on the technical foundations of working with data, this chapter looks at the same topic from a front-end perspective. You see how to change the visual appearance of your data through the use of control styles. You also see how to interact with the data-bound controls and how to speed up your application by keeping a local copy of frequently accessed data.

Chapter 16, "Security in Your ASP.NET 4 Web Site." Although presented quite late in the book, security is a first-class, important topic. This chapter shows you how to make use of the built-in ASP.NET features related to security. You learn about a number of application services that facilitate security. You also learn how to let users sign up for an account on your web site, how to distinguish between anonymous and logged-on users, and how to manage the users in your system.

Chapter 17, "Personalizing Web Sites." Building on the security features introduced in Chapter 16, this chapter shows you how to create personalized web pages with content targeted at individual users. You see how to configure and use ASP.NET Profile that enables you to store personalized data for known and anonymous visitors.

Chapter 18, "Exception Handling, Debugging, and Tracing." In order to understand, improve, and fix the code you write for your ASP.NET web pages you need good debugging tools. Visual Web Developer ships with great debugging support that enables you to diagnose the state of your application at run time, helping you find and fix problems before your users do.

Chapter 19, "Deploying Your Web Site." By the end of the book, you should have a web site that is ready to be shown to the world. But how exactly do you do that? What are the things you need to know and understand to put your web site out in the wild? This chapter gives the answers and provides you with a good look at configuring different production systems in order to run your final web site.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of contents

  1. Copyright
  2. ABOUT THE AUTHOR
  3. CREDITS
  4. ACKNOWLEDGMENTS
  5. FOREWORD
  6. INTRODUCTION
    1. WHO THIS BOOK IS FOR
    2. WHAT THIS BOOK COVERS
    3. HOW THIS BOOK IS STRUCTURED
    4. WHAT YOU NEED TO USE THIS BOOK
    5. CONVENTIONS
      1. Try It Out Conventions
      2. How It Works
    6. SOURCE CODE
    7. ERRATA
    8. P2P.WROX.COM
  7. 1. Getting Started with ASP.NET 4
    1. 1.1. MICROSOFT VISUAL WEB DEVELOPER
      1. 1.1.1. Getting Visual Web Developer
      2. 1.1.2. Installing Visual Web Developer Express
    2. 1.2. CREATING YOUR FIRST ASP.NET 4 WEB SITE
    3. 1.3. AN INTRODUCTION TO ASP.NET 4
      1. 1.3.1. Understanding HTML
        1. 1.3.1.1. HTML Elements and Tags
        2. 1.3.1.2. HTML Attributes
        3. 1.3.1.3. The Difference Between HTML and XHTML
          1. 1.3.1.3.1. Always Close Your Elements
          2. 1.3.1.3.2. Always Use Lowercase for Your Tag and Attribute Names
          3. 1.3.1.3.3. Always Enclose Attribute Values in Quotes
          4. 1.3.1.3.4. Nest Your Elements Correctly
          5. 1.3.1.3.5. Always Add a DOCTYPE Declaration to Your Page
      2. 1.3.2. A First Look at ASP.NET Markup
    4. 1.4. A TOUR OF THE IDE
      1. 1.4.1. The Main Development Area
        1. 1.4.1.1. Choosing Your Development Profile
        2. 1.4.1.2. The Main Menu
        3. 1.4.1.3. The Toolbar Area
        4. 1.4.1.4. The Toolbox
        5. 1.4.1.5. The Solution Explorer
        6. 1.4.1.6. The Database Explorer
        7. 1.4.1.7. The Properties Grid
        8. 1.4.1.8. The Document Window
        9. 1.4.1.9. The Start Page
      2. 1.4.2. Informational Windows
        1. 1.4.2.1. The Error List
        2. 1.4.2.2. The Output Window
        3. 1.4.2.3. The Find Results Window
    5. 1.5. CUSTOMIZING THE IDE
      1. 1.5.1. Rearranging Windows
      2. 1.5.2. Modifying the Toolbox
      3. 1.5.3. Customizing the Document Window
      4. 1.5.4. Customizing Toolbars
        1. 1.5.4.1. Enabling and Disabling Toolbars
        2. 1.5.4.2. Editing Existing Toolbars
        3. 1.5.4.3. Creating Your Own Toolbars
      5. 1.5.5. Customizing Keyboard Shortcuts
      6. 1.5.6. Resetting Your Changes
        1. 1.5.6.1. Resetting the Window Layout
        2. 1.5.6.2. Resetting the Toolbox
        3. 1.5.6.3. Resetting All Settings
    6. 1.6. THE SAMPLE APPLICATION
    7. 1.7. PRACTICAL TIPS ON VISUAL WEB DEVELOPER
    8. 1.8. SUMMARY
  8. 2. Building an ASP.NET Web Site
    1. 2.1. CREATING WEB SITES WITH VWD 2010
      1. 2.1.1. Different Project Types
        1. 2.1.1.1. Web Site Projects
        2. 2.1.1.2. Web Application Projects
      2. 2.1.2. Choosing the Right Web Site Template
        1. 2.1.2.1. ASP.NET Web Site
        2. 2.1.2.2. ASP.NET Empty Web Site
        3. 2.1.2.3. WCF Service
        4. 2.1.2.4. Dynamic Data Web Sites
      3. 2.1.3. Creating and Opening a New Web Site
        1. 2.1.3.1. Creating New Web Sites
        2. 2.1.3.2. Opening Existing Web Sites
    2. 2.2. WORKING WITH FILES IN YOUR WEB SITE
      1. 2.2.1. The Many File Types of an ASP.NET 4 Web Site
        1. 2.2.1.1. Web Files
        2. 2.2.1.2. Code Files
        3. 2.2.1.3. Data Files
      2. 2.2.2. Adding Existing Files
      3. 2.2.3. Organizing Your Site
      4. 2.2.4. Special File Types
    3. 2.3. WORKING WITH WEB FORMS
      1. 2.3.1. The Different Views on Web Forms
      2. 2.3.2. Choosing between Code Behind and Pages with Inline Code
      3. 2.3.3. Adding Markup to Your Page
        1. 2.3.3.1. Inserting and Formatting Text
        2. 2.3.3.2. Adding Tables and Other Markup
      4. 2.3.4. Connecting Pages
    4. 2.4. PRACTICAL TIPS ON WORKING WITH WEB FORMS
    5. 2.5. SUMMARY
  9. 3. Designing Your Web Pages
    1. 3.1. WHY DO YOU NEED CSS?
      1. 3.1.1. Problems of HTML Formatting
      2. 3.1.2. How CSS Fixes Formatting Problems
    2. 3.2. AN INTRODUCTION TO CSS
      1. 3.2.1. CSS—The Language
      2. 3.2.2. The Style Sheet
        1. 3.2.2.1. Selectors
          1. 3.2.2.1.1. The Universal Selector
          2. 3.2.2.1.2. The Type Selector
          3. 3.2.2.1.3. The ID Selector
          4. 3.2.2.1.4. The Class Selector
          5. 3.2.2.1.5. Grouping and Combining Selectors
        2. 3.2.2.2. Properties
        3. 3.2.2.3. Values
        4. 3.2.2.4. Using Shorthand
        5. 3.2.2.5. The CSS Box Model
      3. 3.2.3. Adding CSS to Your Pages
        1. 3.2.3.1. Choosing among External, Embedded, and Inline Style Sheets
    3. 3.3. WORKING WITH CSS IN VISUAL WEB DEVELOPER
      1. 3.3.1. Creating New Styles in External Style Sheets
      2. 3.3.2. Creating Embedded and Inline Style Sheets
      3. 3.3.3. Applying Styles
      4. 3.3.4. Managing Styles
    4. 3.4. PRACTICAL TIPS ON WORKING WITH CSS
    5. 3.5. SUMMARY
  10. 4. Working with ASP.NET Server Controls
    1. 4.1. INTRODUCTION TO SERVER CONTROLS
    2. 4.2. A CLOSER LOOK AT ASP.NET SERVER CONTROLS
      1. 4.2.1. Defining Controls in Your Pages
      2. 4.2.2. Common Properties for All Controls
    3. 4.3. TYPES OF CONTROLS
      1. 4.3.1. Standard Controls
        1. 4.3.1.1. Simple Controls
        2. 4.3.1.2. List Controls
        3. 4.3.1.3. Container Controls
          1. 4.3.1.3.1. A Closer Look at the Panel Control
          2. 4.3.1.3.2. Magic with the Wizard Control
        4. 4.3.1.4. Other Standard Controls
          1. 4.3.1.4.1. LinkButton and ImageButton
          2. 4.3.1.4.2. Image and ImageMap
          3. 4.3.1.4.3. Calendar
          4. 4.3.1.4.4. FileUpload
          5. 4.3.1.4.5. Literal, Localize, and Substitute
          6. 4.3.1.4.6. AdRotator
          7. 4.3.1.4.7. HiddenField
          8. 4.3.1.4.8. XML
          9. 4.3.1.4.9. Table
      2. 4.3.2. HTML Controls
        1. 4.3.2.1. How to Choose between Standard and HTML Controls
      3. 4.3.3. Data Controls
      4. 4.3.4. Validation Controls
      5. 4.3.5. Navigation Controls
      6. 4.3.6. Login Controls
      7. 4.3.7. Ajax Extensions
      8. 4.3.8. WebParts
      9. 4.3.9. Dynamic Data
    4. 4.4. THE ASP.NET STATE ENGINE
      1. 4.4.1. What Is State and Why Is It Important?
      2. 4.4.2. How the State Engine Works
      3. 4.4.3. Not All Controls Rely on View State
      4. 4.4.4. A Note about View State and Performance
    5. 4.5. PRACTICAL TIPS ON WORKING WITH CONTROLS
    6. 4.6. SUMMARY
  11. 5. Programming Your ASP.NET Web Pages
    1. 5.1. INTRODUCTION TO PROGRAMMING
    2. 5.2. DATA TYPES AND VARIABLES
      1. 5.2.1. Converting and Casting Data Types
      2. 5.2.2. Using Arrays and Collections
        1. 5.2.2.1. Defining and Working with Arrays
        2. 5.2.2.2. Defining and Working with Collections
        3. 5.2.2.3. An Introduction to Generics
    3. 5.3. STATEMENTS
      1. 5.3.1. Operators
        1. 5.3.1.1. Assignment Operators
        2. 5.3.1.2. Arithmetic Operators
        3. 5.3.1.3. Comparison Operators
        4. 5.3.1.4. Concatenation Operators
        5. 5.3.1.5. Logical Operators
      2. 5.3.2. Making Decisions
        1. 5.3.2.1. If, If Else, and ElseIf Constructs
        2. 5.3.2.2. Switches / Select Case Constructs
      3. 5.3.3. Loops
        1. 5.3.3.1. The For Loop
        2. 5.3.3.2. The For Each / foreach Loop
        3. 5.3.3.3. The While Loop
    4. 5.4. ORGANIZING CODE
      1. 5.4.1. Methods: Functions and Subroutines
      2. 5.4.2. The App_Code Folder
      3. 5.4.3. Organizing Code with Namespaces
      4. 5.4.4. Writing Comments
        1. 5.4.4.1. Commenting Code Inline
        2. 5.4.4.2. Writing XML Comments
    5. 5.5. OBJECT ORIENTATION BASICS
      1. 5.5.1. Important OO Terminology
        1. 5.5.1.1. Objects
        2. 5.5.1.2. Classes
        3. 5.5.1.3. Properties
          1. 5.5.1.3.1. Creating Read-Only and Write-Only Properties
        4. 5.5.1.4. Methods
        5. 5.5.1.5. Constructors
        6. 5.5.1.6. Inheritance
        7. 5.5.1.7. Access Modifiers
      2. 5.5.2. Events
    6. 5.6. PRACTICAL TIPS ON PROGRAMMING
    7. 5.7. SUMMARY
  12. 6. Creating Consistent Looking Web Sites
    1. 6.1. CONSISTENT PAGE LAYOUT WITH MASTER PAGES
      1. 6.1.1. Creating Master Pages
      2. 6.1.2. Creating Content Pages
        1. 6.1.2.1. A Closer Look at Master Pages
        2. 6.1.2.2. Nesting Master Pages
        3. 6.1.2.3. Master Page Caveats
    2. 6.2. USING A CENTRALIZED BASE PAGE
      1. 6.2.1. An Introduction to the ASP.NET Page Life Cycle
      2. 6.2.2. Implementing the Base Page
      3. 6.2.3. Creating Reusable Page Templates
    3. 6.3. THEMES
      1. 6.3.1. Different Types of Themes
      2. 6.3.2. Choosing Between Theme and StyleSheetTheme
      3. 6.3.3. Applying Themes
      4. 6.3.4. Extending Themes
      5. 6.3.5. Dynamically Switching Themes
    4. 6.4. SKINS
      1. 6.4.1. Creating a Skin File
      2. 6.4.2. Named Skins
      3. 6.4.3. Disable Theming for Specific Controls
    5. 6.5. PRACTICAL TIPS ON CREATING CONSISTENT PAGES
    6. 6.6. SUMMARY
  13. 7. Navigation
    1. 7.1. DIFFERENT WAYS TO MOVE AROUND YOUR SITE
      1. 7.1.1. Understanding Absolute and Relative URLs
        1. 7.1.1.1. Relative URLs
          1. 7.1.1.1.1. Root-Based Relative URLs
          2. 7.1.1.1.2. Relative URLs in Server-Side Controls
        2. 7.1.1.2. Absolute URLs
      2. 7.1.2. Understanding Default Documents
    2. 7.2. USING THE NAVIGATION CONTROLS
      1. 7.2.1. Architecture of the Navigation Controls
      2. 7.2.2. Examining the Web.sitemap File
        1. 7.2.2.1. Key Elements of the Web.sitemap File
      3. 7.2.3. Using the Menu Control
        1. 7.2.3.1. Using the Rendering Mode
        2. 7.2.3.2. Creating a Basic Version of the Menu Control
        3. 7.2.3.3. Styling the Menu Control
      4. 7.2.4. Using the TreeView Control
      5. 7.2.5. Using the SiteMapPath Control
    3. 7.3. PROGRAMMATIC REDIRECTION
      1. 7.3.1. Programmatically Redirecting the Client to a Different Page
      2. 7.3.2. Server-Side Redirects
    4. 7.4. PRACTICAL TIPS ON NAVIGATION
    5. 7.5. SUMMARY
  14. 8. User Controls
    1. 8.1. INTRODUCTION TO USER CONTROLS
      1. 8.1.1. Creating User Controls
      2. 8.1.2. Adding User Controls to a Content Page or Master Page
      3. 8.1.3. Site-Wide Registration of User Controls
      4. 8.1.4. User Control Caveats
        1. 8.1.4.1. Understanding and Managing Client IDs
        2. 8.1.4.2. Introducing ClientIDMode
    2. 8.2. ADDING LOGIC TO YOUR USER CONTROLS
      1. 8.2.1. Creating Your Own Data Types for Properties
      2. 8.2.2. Implementing View State Properties
      3. 8.2.3. View State Considerations
    3. 8.3. PRACTICAL TIPS ON USER CONTROLS
    4. 8.4. SUMMARY
  15. 9. Validating User Input
    1. 9.1. GATHERING DATA FROM THE USER
      1. 9.1.1. Validating User Input in Web Forms
        1. 9.1.1.1. The ASP.NET Validation Controls
        2. 9.1.1.2. A Warning on Client-Side Validation
        3. 9.1.1.3. Using the Validation Controls
        4. 9.1.1.4. The Standard Validation Controls
          1. 9.1.1.4.1. The Difference between the Text and ErrorMessage Properties
          2. 9.1.1.4.2. RangeValidator
          3. 9.1.1.4.3. RegularExpressionValidator
          4. 9.1.1.4.4. CompareValidator
        5. 9.1.1.5. The CustomValidator and ValidationSummary Controls
      2. 9.1.2. Understanding Request Validation
    2. 9.2. PROCESSING DATA AT THE SERVER
      1. 9.2.1. Sending E-mail from Your Web Site
        1. 9.2.1.1. Configuring Your Web Site for Sending E-mail
        2. 9.2.1.2. Creating E-mail Messages
      2. 9.2.2. Reading from Text Files
    3. 9.3. PRACTICAL TIPS ON VALIDATING DATA
    4. 9.4. SUMMARY
  16. 10. ASP.NET AJAX
    1. 10.1. INTRODUCING AJAX
    2. 10.2. USING ASP.NET AJAX IN YOUR PROJECTS
      1. 10.2.1. Creating Flicker-Free Pages
        1. 10.2.1.1. The UpdatePanel Control
        2. 10.2.1.2. A Closer Look at the UpdatePanel
          1. 10.2.1.2.1. Common UpdatePanel Properties
          2. 10.2.1.2.2. UpdatePanel Caveats
        3. 10.2.1.3. The ScriptManager Control
      2. 10.2.2. Providing Feedback to Users
        1. 10.2.2.1. The UpdateProgress Control
      3. 10.2.3. The Timer Control
    3. 10.3. USING WEB SERVICES AND PAGE METHODS IN AJAX WEB SITES
      1. 10.3.1. What Are Web Services?
      2. 10.3.2. Creating Web Services
      3. 10.3.3. Using Web Services in Your Ajax Web Site
        1. 10.3.3.1. Configuring the Web Service
        2. 10.3.3.2. Configuring the ScriptManager
      4. 10.3.4. Introducing Page Methods
      5. 10.3.5. The Client-Side ASP.NET AJAX Library
      6. 10.3.6. This Is Just the Beginning
    4. 10.4. PRACTICAL AJAX TIPS
    5. 10.5. SUMMARY
  17. 11. jQuery
    1. 11.1. AN INTRODUCTION TO JQUERY
      1. 11.1.1. Choosing the Location for Your jQuery Reference
      2. 11.1.2. Different Ways to Include the jQuery Library
    2. 11.2. JQUERY SYNTAX
      1. 11.2.1. jQuery Core
      2. 11.2.2. Selecting Items Using jQuery
        1. 11.2.2.1. Basic Selectors
          1. 11.2.2.1.1. The Universal Selector
          2. 11.2.2.1.2. The ID Selector
          3. 11.2.2.1.3. The Element Selector
          4. 11.2.2.1.4. The Class Selector
          5. 11.2.2.1.5. Grouped and Combined Selectors
        2. 11.2.2.2. Basic Filters
        3. 11.2.2.3. Advanced Filters
    3. 11.3. MODIFYING THE DOM WITH JQUERY
      1. 11.3.1. CSS Methods
        1. 11.3.1.1. css(name, value)
        2. 11.3.1.2. css(name)
        3. 11.3.1.3. css(properties)
        4. 11.3.1.4. addClass, removeClass, and toggleClass
      2. 11.3.2. Handling Events
      3. 11.3.3. Miscellaneous jQuery Functionality
      4. 11.3.4. Common Mistakes When Working with jQuery
        1. 11.3.4.1. Your ID Selectors Don't Work
        2. 11.3.4.2. Your ID Selectors Don't Work, Even with a Hash Symbol
        3. 11.3.4.3. None of Your Code Seems to Run
    4. 11.4. EFFECTS WITH JQUERY
    5. 11.5. JQUERY AND EXTENSIBILITY
    6. 11.6. PRACTICAL TIPS ON JQUERY
    7. 11.7. SUMMARY
  18. 12. Introducing Databases
    1. 12.1. WHAT IS A DATABASE?
    2. 12.2. DIFFERENT KINDS OF RELATIONAL DATABASES
    3. 12.3. USING SQL TO WORK WITH DATABASE DATA
    4. 12.4. RETRIEVING AND MANIPULATING DATA WITH SQL
      1. 12.4.1. Reading Data
        1. 12.4.1.1. Selecting Data
        2. 12.4.1.2. Filtering Data
        3. 12.4.1.3. Ordering Data
        4. 12.4.1.4. Joining Data
      2. 12.4.2. Creating Data
      3. 12.4.3. Updating Data
      4. 12.4.4. Deleting Data
    5. 12.5. CREATING YOUR OWN TABLES
      1. 12.5.1. Data Types in SQL Server
      2. 12.5.2. Understanding Primary Keys and Identities
      3. 12.5.3. Creating Relationships Between Tables
    6. 12.6. PRACTICAL DATABASE TIPS
    7. 12.7. SUMMARY
  19. 13. Displaying and Updating Data
    1. 13.1. DATA CONTROLS
      1. 13.1.1. Data-bound Controls
        1. 13.1.1.1. List Controls
        2. 13.1.1.2. Single Item Controls
        3. 13.1.1.3. Paging Controls
      2. 13.1.2. Data Source Controls
      3. 13.1.3. Other Data Controls
    2. 13.2. DATA SOURCE AND DATA-BOUND CONTROLS WORKING TOGETHER
      1. 13.2.1. Displaying and Editing Data with GridView
      2. 13.2.2. Inserting Data with DetailsView
      3. 13.2.3. Storing Your Connection Strings in web.config
      4. 13.2.4. Filtering Data
    3. 13.3. CUSTOMIZING THE APPEARANCE OF THE DATA CONTROLS
      1. 13.3.1. Configuring Columns or Fields of Data-bound Controls
    4. 13.4. UPDATING AND INSERTING DATA
      1. 13.4.1. Using DetailsView to Insert and Update Data
    5. 13.5. PRACTICAL TIPS FOR DISPLAYING AND UPDATING DATA
    6. 13.6. SUMMARY
  20. 14. LINQ and the ADO.NET Entity Framework
    1. 14.1. INTRODUCING LINQ
      1. 14.1.1. LINQ to Objects
      2. 14.1.2. LINQ to XML
      3. 14.1.3. LINQ to ADO.NET
    2. 14.2. INTRODUCING THE ADO.NET ENTITY FRAMEWORK
    3. 14.3. MAPPING YOUR DATA MODEL TO AN OBJECT MODEL
    4. 14.4. INTRODUCING QUERY SYNTAX
      1. 14.4.1. Standard Query Operators
        1. 14.4.1.1. Select
        2. 14.4.1.2. From
        3. 14.4.1.3. Order By
        4. 14.4.1.4. Where
        5. 14.4.1.5. Sum, Min, Max, Average, and Count
        6. 14.4.1.6. Take, Skip, TakeWhile, and SkipWhile
        7. 14.4.1.7. Single and SingleOrDefault
        8. 14.4.1.8. First, FirstOrDefault, Last, and LastOrDefault
      2. 14.4.2. Shaping Data with Anonymous Types
    5. 14.5. USING SERVER CONTROLS WITH LINQ QUERIES
      1. 14.5.1. Using Data Controls with the Entity Framework
        1. 14.5.1.1. Introducing the EntityDataSource Control
        2. 14.5.1.2. Introducing the ListView Control
        3. 14.5.1.3. Introducing the DataPager Control
      2. 14.5.2. A Few Notes about Performance
    6. 14.6. PRACTICAL LINQ AND ADO.NET ENTITY FRAMEWORK TIPS
    7. 14.7. SUMMARY
  21. 15. Working with Data — Advanced Topics
    1. 15.1. FORMATTING YOUR CONTROLS USING STYLES
      1. 15.1.1. An Introduction to Styles
      2. 15.1.2. Combining Styles, Themes, and Skins
    2. 15.2. HANDLING EVENTS
      1. 15.2.1. The ASP.NET Page and Control Life Cycles Revisited
      2. 15.2.2. The ASP.NET Page Life Cycle and Events in Data Controls
      3. 15.2.3. Handling Errors that Occur in the Data Source Controls
    3. 15.3. HAND-CODING DATA ACCESS CODE
    4. 15.4. CACHING
      1. 15.4.1. Common Pitfalls with Caching Data
        1. 15.4.1.1. Avoiding Stale Data
        2. 15.4.1.2. Don't Rely on the Data Being There
      2. 15.4.2. Different Ways to Cache Data in ASP.NET Web Applications
        1. 15.4.2.1. Output Caching
        2. 15.4.2.2. Caching with Data Source Controls
        3. 15.4.2.3. Programmatic Caching
    5. 15.5. PRACTICAL DATA TIPS
    6. 15.6. SUMMARY
  22. 16. Security in Your ASP.NET 4 Web Site
    1. 16.1. INTRODUCING SECURITY
      1. 16.1.1. Identity: Who Are You?
      2. 16.1.2. Authentication: How Can You Prove Who You Are?
      3. 16.1.3. Authorization: What Are You Allowed to Do?
      4. 16.1.4. An Introduction to the ASP.NET Application Services
    2. 16.2. INTRODUCING THE LOGIN CONTROLS
      1. 16.2.1. The Login Controls
        1. 16.2.1.1. Login
        2. 16.2.1.2. LoginView
        3. 16.2.1.3. LoginStatus
        4. 16.2.1.4. LoginName
        5. 16.2.1.5. CreateUserWizard
        6. 16.2.1.6. PasswordRecovery
        7. 16.2.1.7. ChangePassword
      2. 16.2.2. Configuring Your Web Application
    3. 16.3. THE ROLE MANAGER
      1. 16.3.1. Configuring the Role Manager
      2. 16.3.2. Managing Users with the WSAT
      3. 16.3.3. Configuring the Web Application to Work with Roles
      4. 16.3.4. Programmatically Checking Roles
    4. 16.4. PRACTICAL SECURITY TIPS
    5. 16.5. SUMMARY
  23. 17. Personalizing Web Sites
    1. 17.1. UNDERSTANDING PROFILE
      1. 17.1.1. Configuring the Profile
        1. 17.1.1.1. Creating Simple Profile Properties
        2. 17.1.1.2. Creating Profile Groups
        3. 17.1.1.3. Using Non-standard Data Types
      2. 17.1.2. Using the Profile
    2. 17.2. OTHER WAYS OF DEALING WITH PROFILE
      1. 17.2.1. Anonymous Identification
      2. 17.2.2. Cleaning Up Old Anonymous Profiles
      3. 17.2.3. Looking at Other Users' Profiles
    3. 17.3. PRACTICAL PERSONALIZATION TIPS
    4. 17.4. SUMMARY
  24. 18. Exception Handling, Debugging, and Tracing
    1. 18.1. EXCEPTION HANDLING
      1. 18.1.1. Different Types of Errors
        1. 18.1.1.1. Syntax Errors
        2. 18.1.1.2. Logic Errors
        3. 18.1.1.3. Runtime Errors
      2. 18.1.2. Catching and Handling Exceptions
      3. 18.1.3. Global Error Handling and Custom Error Pages
    2. 18.2. THE BASICS OF DEBUGGING
    3. 18.3. TOOLS SUPPORT FOR DEBUGGING
      1. 18.3.1. Moving around in Debugged Code
      2. 18.3.2. Debugging Windows
        1. 18.3.2.1. Watching Variables
          1. 18.3.2.1.1. The Watch Window
          2. 18.3.2.1.2. The Autos Window
          3. 18.3.2.1.3. The Locals Window
        2. 18.3.2.2. Other Windows
          1. 18.3.2.2.1. The Breakpoints Window
          2. 18.3.2.2.2. Call Stack Window
          3. 18.3.2.2.3. Immediate Window
    4. 18.4. DEBUGGING CLIENT-SIDE SCRIPT
    5. 18.5. TRACING YOUR ASP.NET WEB PAGES
      1. 18.5.1. Using the Standard Tracing Capabilities
        1. 18.5.1.1. Tracing with Individual Pages
        2. 18.5.1.2. Tracing the Entire Web Site
      2. 18.5.2. Adding Your Own Information to the Trace
      3. 18.5.3. Tracing and Performance
      4. 18.5.4. A Security Warning
    6. 18.6. PRACTICAL DEBUGGING TIPS
    7. 18.7. SUMMARY
  25. 19. Deploying Your Web Site
    1. 19.1. PREPARING YOUR WEB SITE FOR DEPLOYMENT
      1. 19.1.1. Avoiding Hardcoded Settings
      2. 19.1.2. The web.config File
      3. 19.1.3. Expression Syntax
      4. 19.1.4. The WebConfigurationManager Class
    2. 19.2. COPYING YOUR WEB SITE
      1. 19.2.1. Creating a Simple Copy of Your Web Site
      2. 19.2.2. Publishing Your Web Site
    3. 19.3. RUNNING YOUR SITE UNDER IIS
      1. 19.3.1. Installing and Configuring the Web Server
        1. 19.3.1.1. Making Sure IIS Is Installed
          1. 19.3.1.1.1. Windows Vista and Windows 7
          2. 19.3.1.1.2. Windows Server 2008 / Windows Server 2008 R2
      2. 19.3.2. Installing and Configuring ASP.NET
      3. 19.3.3. Understanding Security in IIS
      4. 19.3.4. NTFS Settings for Planet Wrox
      5. 19.3.5. Troubleshooting Web Server Errors
    4. 19.4. MOVING DATA TO A REMOTE SERVER
      1. 19.4.1. Using the Database Publishing Wizard
      2. 19.4.2. Recreating the Database
    5. 19.5. THE DEPLOYMENT CHECKLIST
    6. 19.6. WHAT'S NEXT
    7. 19.7. SUMMARY
  26. A. Exercise Answers
    1. A.1. CHAPTER 1
      1. A.1.1. Exercise 1 Solution
      2. A.1.2. Exercise 2 Solution
      3. A.1.3. Exercise 3 Solution
      4. A.1.4. Exercise 4 Solution
      5. A.1.5. Exercise 5 Solution
    2. A.2. CHAPTER 2
      1. A.2.1. Exercise 1 Solution
      2. A.2.2. Exercise 2 Solution
      3. A.2.3. Exercise 3 Solution
      4. A.2.4. Exercise 4 Solution
    3. A.3. CHAPTER 3
      1. A.3.1. Exercise 1 Solution
      2. A.3.2. Exercise 2 Solution
      3. A.3.3. Exercise 3 Solution
      4. A.3.4. Exercise 4 Solution
    4. A.4. CHAPTER 4
      1. A.4.1. Exercise 1 Solution
      2. A.4.2. Exercise 2 Solution
      3. A.4.3. Exercise 3 Solution
      4. A.4.4. Exercise 4 Solution
      5. A.4.5. Exercise 5 Solution
      6. A.4.6. Exercise 6 Solution
    5. A.5. CHAPTER 5
      1. A.5.1. Exercise 1 Solution
      2. A.5.2. Exercise 2 Solution
      3. A.5.3. Exercise 3 Solution
    6. A.6. CHAPTER 6
      1. A.6.1. Exercise 1 Solution
      2. A.6.2. Exercise 2 Solution
      3. A.6.3. Exercise 3 Solution
      4. A.6.4. Exercise 4 Solution
      5. A.6.5. Exercise 5 Solution
      6. A.6.6. Exercise 6 Solution
    7. A.7. CHAPTER 7
      1. A.7.1. Exercise 1 Solution
      2. A.7.2. Exercise 2 Solution
      3. A.7.3. Exercise 3 Solution
    8. A.8. CHAPTER 8
      1. A.8.1. Exercise 1 Solution
      2. A.8.2. Exercise 2 Solution
      3. A.8.3. Exercise 3 Solution
    9. A.9. CHAPTER 9
      1. A.9.1. Exercise 1 Solution
      2. A.9.2. Exercise 2 Solution
      3. A.9.3. Exercise 3 Solution
      4. A.9.4. Exercise 4 Solution
      5. A.9.5. Exercise 5 Solution
    10. A.10. CHAPTER 10
      1. A.10.1. Exercise 1 Solution
      2. A.10.2. Exercise 2 Solution
      3. A.10.3. Exercise 3 Solution
      4. A.10.4. Exercise 4 Solution
    11. A.11. CHAPTER 11
      1. A.11.1. Exercise 1 Solution
      2. A.11.2. Exercise 2 Solution
      3. A.11.3. Exercise 3 Solution
    12. A.12. CHAPTER 12
      1. A.12.1. Exercise 1 Solution
      2. A.12.2. Exercise 2 Solution
      3. A.12.3. Exercise 3 Solution
      4. A.12.4. Exercise 4 Solution
      5. A.12.5. Exercise 5 Solution
    13. A.13. CHAPTER 13
      1. A.13.1. Exercise 1 Solution
      2. A.13.2. Exercise 2 Solution
      3. A.13.3. Exercise 3 Solution
      4. A.13.4. Exercise 4 Solution
    14. A.14. CHAPTER 14
      1. A.14.1. Exercise 1 Solution
      2. A.14.2. Exercise 2 Solution
      3. A.14.3. Exercise 3 Solution
      4. A.14.4. Exercise 4 Solution
      5. A.14.5. Exercise 5 Solution
    15. A.15. CHAPTER 15
      1. A.15.1. Exercise 1 Solution
      2. A.15.2. Exercise 2 Solution
      3. A.15.3. Exercise 3 Solution
    16. A.16. CHAPTER 16
      1. A.16.1. Exercise 1 Solution
      2. A.16.2. Exercise 2 Solution
      3. A.16.3. Exercise 3 Solution
      4. A.16.4. Exercise 4 Solution
    17. A.17. CHAPTER 17
      1. A.17.1. Exercise 1 Solution
      2. A.17.2. Exercise 2 Solution
      3. A.17.3. Exercise 3 Solution
    18. A.18. CHAPTER 18
      1. A.18.1. Exercise 1 Solution
      2. A.18.2. Exercise 2 Solution
      3. A.18.3. Exercise 3 Solution
  27. B. Configuring SQL Server 2008
    1. B.1. CONFIGURING SQL SERVER 2008
      1. B.1.1. Terminology and Concepts
        1. B.1.1.1. SQL Server Authentication
        2. B.1.1.2. Windows Authentication
        3. B.1.1.3. Choosing between Windows and Server Authentication
      2. B.1.2. Using SQL Server Management Studio
        1. B.1.2.1. Obtaining and Installing SQL Server Management Studio Express
      3. B.1.3. Enabling Remote Connections in SQL Server
        1. B.1.3.1. Attaching Databases to SQL Server
      4. B.1.4. Connecting Your Application to SQL Server 2008
        1. B.1.4.1. Scenario 1 — Using SQL Server Authentication
        2. B.1.4.2. Scenario 2 — Using Windows Authentication with IIS and the Database on the Same Machine
    2. B.2. CONFIGURING APPLICATION SERVICES
      1. B.2.1. Configuring Your Database for the Application Services
      2. B.2.2. Overriding the LocalSqlServer Connection String
      3. B.2.3. Overriding the Settings of the Application Services

Product information

  • Title: Beginning ASP.NET 4: in C# and VB
  • Author(s):
  • Release date: March 2010
  • Publisher(s): Wrox
  • ISBN: 9780470502211