1. Trang chủ
  2. » Công Nghệ Thông Tin

Build your own ASP NET4 website using CSharp and VB 4th edition

834 1.8K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Build Your Own ASP.NET 4 Website Using C# & VB

  • Table of Contents

  • Foreword

  • Preface

    • Who Should Read This Book

    • What’s in This Book

    • Where to Find Help

      • The SitePoint Forums

      • The Book’s Website

        • The Code Archive

        • Updates and Errata

    • The SitePoint Newsletters

    • The SitePoint Podcast

    • Your Feedback

    • Acknowledgments

    • Conventions Used in This Book

      • Code Samples

      • Tips, Notes, and Warnings

  • Introducing ASP.NET and the .NET Platform

    • What is ASP.NET?

    • Installing the Required Software

      • Installing Visual Web Developer 2010 Express Edition

      • Installing SQL Server Management Studio Express

    • Writing Your First ASP.NET Page

    • Getting Help

    • Summary

  • ASP.NET Basics

    • ASP.NET Page Structure

      • Directives

      • Code Declaration Blocks

        • Comments in VB and C# Code

        • <script> Tag Attributes

      • Code Render Blocks

      • ASP.NET Server Controls

      • Server-side Comments

      • Literal Text and HTML Tags

    • View State

    • Working with Directives

    • ASP.NET Languages

      • Visual Basic

      • C#

    • Summary

  • VB and C# Programming Basics

    • Programming Basics

      • Control Events and Subroutines

      • Page Events

      • Variables and Variable Declaration

      • Arrays

      • Functions

      • Operators

        • Breaking Long Lines of Code

      • Conditional Logic

      • Loops

    • Object Oriented Programming Concepts

      • Objects and Classes

      • Properties

      • Methods

      • Classes

      • Constructors

      • Scope

      • Events

      • Understanding Inheritance

      • Objects in .NET

      • Namespaces

    • Using Code-behind Files

    • Summary

  • Constructing ASP.NET Web Pages

    • Web Forms

    • HTML Server Controls

      • Using the HTML Server Controls

    • Web Server Controls

      • Standard Web Server Controls

        • Label

        • Literal

        • TextBox

        • HiddenField

        • Button

        • ImageButton

        • LinkButton

        • HyperLink

        • CheckBox

        • RadioButton

        • Image

        • ImageMap

        • PlaceHolder

        • Panel

      • List Controls

        • DropDownList

        • ListBox

        • RadioButtonList

        • CheckBoxList

        • BulletedList

      • Advanced Controls

        • Calendar

        • AdRotator

        • TreeView

        • SiteMapPath

        • Menu

        • MultiView

        • Wizard

        • FileUpload

    • Web User Controls

      • Creating a Web User Control

        • Using the Web User Control

    • Master Pages

    • Using Cascading Style Sheets (CSS)

      • Types of Styles and Style Sheets

        • Style Properties

        • The CssClass Property

    • Summary

  • Building Web Applications

    • Introducing the Dorknozzle Project

    • Using Visual Web Developer

      • Meeting the Features

        • The Solution Explorer

        • The Web Forms Designer

        • The Code Editor

        • IntelliSense

        • The Toolbox

        • The Properties Window

    • Executing Your Project

    • Core Web Application Features

      • Web.config

      • Global.asax

      • Using Application State

      • Working with User Sessions

      • Using the Cache Object

      • Using Cookies

    • Starting the Dorknozzle Project

      • Preparing the Sitemap

      • Using Themes, Skins, and Styles

        • Creating a New Theme Folder

        • Creating a New Style Sheet

        • Styling Web Server Controls

        • Adding a Skin

        • Applying the Theme

      • Building the Master Page

      • Using the Master Page

    • Extending Dorknozzle

    • Debugging and Error Handling

      • Debugging with Visual Web Developer

      • Other Kinds of Errors

      • Custom Errors

      • Handling Exceptions Locally

    • Summary

  • Using the Validation Controls

    • Client-side Validation and Server-side Validation

    • Introducing the ASP.NET Validation Controls

      • Enforcing Validation on the Server

    • Using Validation Controls

      • RequiredFieldValidator

      • CompareValidator

      • RangeValidator

      • ValidationSummary

      • RegularExpressionValidator

        • Some Useful Regular Expressions

      • CustomValidator

    • Validation Groups

    • Updating Dorknozzle

    • Summary

  • Database Design and Development

    • What Is a Database?

    • Creating Your First Database

      • Creating a New Database Using Visual Web Developer

      • Creating a New Database Using SQL Server Management Studio

    • Creating Database Tables

      • Data Types

      • Column Properties

      • Primary Keys

      • Creating the Employees Table

      • Creating the Remaining Tables

        • Executing SQL Scripts

      • Populating the Data Tables

    • Relational Database Design Concepts

      • Foreign Keys

      • Using Database Diagrams

      • Implementing Relationships in the Dorknozzle Database

      • Diagrams and Table Relationships

        • One-to-one Relationships

        • One-to-many Relationships

        • Many-to-many Relationships

    • Summary

  • Speaking SQL

    • Reading Data from a Single Table

      • Using the SELECT Statement

      • Selecting Certain Fields

      • Selecting Unique Data with DISTINCT

      • Row Filtering with WHERE

      • Selecting Ranges of Values with BETWEEN

      • Matching Patterns with LIKE

      • Using the IN Operator

      • Sorting Results Using ORDER BY

      • Limiting the Number of Results with TOP

    • Reading Data from Multiple Tables

      • Subqueries

      • Table Joins

    • Expressions and Operators

    • Transact-SQL (T-SQL) Functions

      • Arithmetic Functions

      • String Functions

      • Date and Time Functions

    • Working with Groups of Values

      • The COUNT Function

      • Grouping Records Using GROUP BY

      • Filtering Groups Using HAVING

      • The SUM, AVG, MIN, and MAX Functions

    • Updating Existing Data

      • The INSERT Statement

      • The UPDATE Statement

      • The DELETE Statement

    • Stored Procedures

    • Summary

  • ADO.NET

    • Introducing ADO.NET

      • Importing the SqlClient Namespace

      • Defining the Database Connection

      • Preparing the Command

      • Executing the Command

      • Setting Up Database Authentication

      • Reading the Data

      • Using Parameters with Queries

      • Bulletproofing Data Access Code

      • Using the Repeater Control

    • Creating the Dorknozzle Employee Directory

      • More Data Binding

      • Inserting Records

      • Updating Records

      • Deleting Records

      • Using Stored Procedures

    • Summary

  • Displaying Content Using Data Lists

    • DataList Basics

    • Handling DataList Events

    • Editing DataList Items and Using Templates

    • DataList and Visual Web Developer

    • Styling the DataList

    • Summary

  • Managing Content Using GridView and DetailsView

    • Using the GridView Control

      • Customizing the GridView Columns

      • Styling the GridView with Templates, Skins, and CSS

      • Selecting Grid Records

    • Using the DetailsView Control

      • Styling the DetailsView

    • GridView and DetailsView Events

      • Entering Edit Mode

      • Using Templates

      • Updating DetailsView Records

    • Summary

  • Advanced Data Access

    • Using Data Source Controls

      • Binding the GridView to a SqlDataSource

      • Binding the DetailsView to a SqlDataSource

      • Displaying Lists in DetailsView

      • More on SqlDataSource

    • Working with Data Sets and Data Tables

      • What Is a Data Set Made From?

      • Binding DataSets to Controls

      • Implementing Paging

      • Storing Data Sets in View State

      • Implementing Sorting

      • Filtering Data

    • Updating a Database from a Modified DataSet

    • Summary

  • Security and User Authentication

    • Basic Security Guidelines

    • Securing ASP.NET Applications

      • Working with Forms Authentication

        • Adding a Login Page to Dorknozzle

        • Authenticating Users

        • Configuring Forms Authentication

        • Configuring Forms Authorization

        • Storing Users in Web.config

        • Hashing Passwords

        • Logging Users Out

    • ASP.NET Memberships and Roles

      • Creating the Membership Data Structures

      • Using Your Database to Store Membership Data

      • Using the ASP.NET Web Site Configuration Tool

      • Creating Users and Roles

      • Changing Password Strength Requirements

      • Securing Your Web Application

      • Using the ASP.NET Login Controls

        • Authenticating Users

        • Customizing User Display

    • Summary

  • Working with Files and Email

    • Writing and Reading Text Files

      • Setting Up Permissions

      • Writing Content to a Text File

      • Reading Content from a Text File

    • Accessing Directories and Directory Information

      • Working with Directory and File Paths

    • Uploading Files

    • Sending Email with ASP.NET

      • Sending a Test Email

      • Creating the Company Newsletters Page

    • Summary

  • Introduction to LINQ

    • Extension Methods

      • LINQ to SQL

      • Updating Data

      • Relationships

      • Directly Executing Queries from the DataContext

      • Stored Procedures with LINQ-to-SQL

      • Using ASP.NET and LINQ-to-SQL

  • Introduction to MVC

    • Summary

  • ASP.NET AJAX

    • What is Ajax?

    • ASP.NET AJAX

    • Using the UpdatePanel Control

      • Managing the ScriptManager Control

    • Using Triggers to Update an UpdatePanel

    • The ASP.NET AJAX Control Toolkit

      • The ValidatorCalloutExtender Control Extender

      • Getting Started with Animation

    • jQuery

    • Summary

  • Appendix A: Web Control Reference

    • The WebControl Class

      • Properties

      • Methods

    • Standard Web Controls

      • AdRotator

        • Properties

        • Events

      • BulletedList

        • Properties

        • Events

      • Button

        • Properties

        • Events

      • Calendar

        • Properties

        • Events

      • CheckBox

        • Properties

        • Events

      • CheckBoxList

        • Properties

        • Events

      • DropDownList

        • Properties

        • Events

      • FileUpload

        • Properties

        • Methods

      • HiddenField

        • Properties

      • HyperLink

        • Properties

      • Image

        • Properties

      • ImageButton

        • Properties

        • Events

      • ImageMap

        • Properties

        • Events

      • Label

        • Properties

      • LinkButton

        • Properties

        • Events

      • ListBox

        • Properties

        • Events

      • Literal

        • Properties

      • MultiView

        • Properties

        • Methods

        • Events

      • Panel

        • Properties

      • PlaceHolder

        • Properties

      • RadioButton

        • Properties

        • Events

      • RadioButtonList

        • Properties

        • Events

      • TextBox

        • Properties

        • Events

      • Wizard

        • Properties

        • Methods

        • Events

      • Xml

        • Properties

    • Validation Controls

      • CompareValidator

        • Properties

        • Methods

      • CustomValidator

        • Methods

        • Events

      • RangeValidator

        • Properties

        • Methods

      • RegularExpressionValidator

        • Properties

        • Methods

      • RequiredFieldValidator

        • Properties

        • Methods

      • ValidationSummary

        • Properties

    • Navigation Web Controls

      • SiteMapPath

        • Properties

        • Methods

        • Events

      • Menu

        • Properties

        • Methods

        • Events

      • TreeView

        • Properties

        • Methods

        • Events

    • Ajax Web Extensions

      • ScriptManager

        • Properties

        • Events

      • Timer

        • Properties

      • UpdatePanel

        • Properties

        • Methods

      • UpdateProgress

        • Properties

  • Appendix B: Deploying ASP.NET Websites

    • ASP.NET Hosting Considerations

    • Using Visual Web Developer Express to Deploy ASP.NET Websites

    • Deploying MVC Sites and Web Applications

    • ASP.NET Deployment “Gotchas”

    • Using the SQL Server Hosting Toolkit

    • Dealing with SQL Security

  • Index

Nội dung

Pantone: CMYK: BUILD YOUR OWN ASP.NET WEBSITE Grey scale PANTONE Orange 021 C PANTONE 2955 C CMYK O, 53, 100, CMYK 100, 45, 0, 37 Black 50% Black 100% USING C# & VB BY CRISTIAN DARIE WYATT BARNETT & TIM POSEY 4TH EDITION THE ULTIMATE ASP.NET BEGINNER’S GUIDE Summary of Contents Foreword xxi Preface xxiii Introducing ASP.NET and the NET Platform ASP.NET Basics 27 VB and C# Programming Basics 47 Constructing ASP.NET Web Pages 97 Building Web Applications 159 Using the Validation Controls 235 Database Design and Development 273 Speaking SQL 317 ADO.NET 363 10 Displaying Content Using Data Lists 435 11 Managing Content Using GridView and DetailsView 463 12 Advanced Data Access 507 13 Security and User Authentication 569 14 Working with Files and Email 615 15 Introduction to LINQ 655 16 Introduction to MVC 671 17 ASP.NET AJAX 701 A Web Control Reference 723 B Deploying ASP.NET Websites 763 Index 775 BUILD YOUR OWN ASP.NET WEBSITE USING C# & VB BY CRISTIAN DARIE WYATT BARNETT TIM POSEY 4TH EDITION iv Build Your Own ASP.NET Website Using C# & VB by Cristian Darie, Wyatt Barnett, and Tim Posey Copyright © 2011 SitePoint Pty Ltd Expert Reviewer: Pranav Rastogi Editor: Sarah Broomhall Product Editor: Simon Mackie Index Editor: Michelle Combs Technical Editor: Ricky Onsman Cover Design: Alex Walker Printing History: Latest Update: Fourth Edition: September First Edition: April 2004 Second Edition: October 2006 Third Edition: September 2008 2011 Notice of Rights All rights reserved No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews Notice of Liability The author and publisher have made every effort to ensure the accuracy of the information herein However, the information contained in this book is sold without warranty, either express or implied Neither the authors and SitePoint Pty Ltd., nor its dealers or distributors, will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein Trademark Notice Rather than indicating every occurrence of a trademarked name as such, this book uses the names only in an editorial fashion and to the benefit of the trademark owner with no intention of infringement of the trademark Published by SitePoint Pty Ltd 48 Cambridge Street Collingwood VIC Australia 3066 Web: www.sitepoint.com Email: business@sitepoint.com ISBN 978-0-9870908-6-7 (print) ISBN 978-0-9871530-3-6 (ebook) Printed and bound in the United States of America v About the Authors Cristian Darie is a software engineer with experience in a wide range of modern technologies, and the author of numerous technical books, including the popular Beginning E-Commerce series He initially tasted programming success with a prize in his first programming contest at the age of 12 From there, Cristian moved on to many other similar achievements, and is now studying distributed application architectures for his PhD Wyatt Barnett leads the in-house development team for a major industry trade association in Washington DC When not slinging obscene amounts of C# and SQL at a few exceedingly large monitors, he is most often spotted staring at HDTV and other forms of entertainment in local watering holes Tim Posey is a long-time developer and a passionate educator Armed with a B.S in Computer Science and an M.B.A in Finance, he has traversed many industries, consulting for multiple corporations in banking, insurance, energy, and various e-commerce industries As a serial entrepreneur, he mentors local startups and non-profit organizations He serves as a senior software engineer at a Fortune 1000 company and an Adjunct Professor of Finance for the American Public University System His favorite pastime is watching Alabama football He may be contacted at tim@timposey.net About the Technical Editor Ricky Onsman is an Australian freelance web designer and jack of all trades With a background in information and content services, he built his first website in 1994 for a disability information service and has been messing about on the web ever since He is the president of the Web Industry Professionals Association About SitePoint SitePoint specializes in publishing fun, practical, and easy-to-understand content for web professionals Visit http://www.sitepoint.com/ to access our books, newsletters, articles, and community forums To my family and friends —Cristian Darie To my Father, whose guidance got me this far —Wyatt Barnett For LJ and Erin —Tim Posey Table of Contents Foreword xxi Preface xxiii Who Should Read This Book xxiii What’s in This Book xxiv Where to Find Help xxviii The SitePoint Forums xxviii The Book’s Website xxviii The SitePoint Newsletters xxix The SitePoint Podcast xxix Your Feedback xxix Acknowledgments xxx Conventions Used in This Book xxx Code Samples xxx Tips, Notes, and Warnings xxxi Chapter Introducing ASP.NET and the NET Platform What is ASP.NET? Installing the Required Software Installing Visual Web Developer 2010 Express Edition Installing SQL Server Management Studio Express Writing Your First ASP.NET Page 11 Getting Help 25 Summary 25 787 I identity columns, 287, 290, 296, 299 identity increment, 287 IDENTITY property, 287, 289–290, 291, 410 identity seed, 287 If statements, 69 IIf statement, 526 IIS, permissions, 617–618 Image control, 114 ImageButton control, 112–113 ImageField control, 478 ImageMap control, 114–115 images, in emails, 646–647, 650 ImageUrl attribute, 113 img tag, 114, 646, 650 Import directive, 32, 45, 92 IN, 341 IN operator, 332–333 Inactive mode, 115 incrementing variables, 73 IndexOutOfRangeException, 220 inheritance, 84–85, 93 initialization, 57 inline code, 35–36 inline expressions, 35, 36 Insert method, 193 INSERT query, 405–411 INSERT statement, 352–353 InsertCommand property, 563 inserting elements, 115 InsertItemTemplate, 498 instance methods, 622 instantiating a class, 82 int data type, 285 integer data type, 58 Integrated Security attribute, 367, 371 IntelliSense, 169–170 Internet Explorer debugging in, 16, 173 disabling JavaScript, 242 setting as default, 17 Is Nothing, 188 IsBodyHtml property, 640, 649 IsPathRooted, 635 IsPostBack property, 403–404 IsValid property, 242–244, 265 ItemCommand event, 442–444 ItemDeleted event, 491 ItemDeleting event, 491 ItemInserted event, 491 ItemInserting event, 491 ItemStyle property, 460 ItemTemplate, 389, 438, 439, 498 ItemUpdated event, 491 ItemUpdating event, 491, 500 ItemUpdating method, 501 J JavaScript AJAX library, 703 browser support, 239 data typing, 59 disabling, 241–242 DOM scripting and, 702 file location, 164 in script tags, 35 security issues, 571 validation and, 236–237 joining tables, 337–338 jQuery, 164, 720–721 788 K keys data, 483, 503 foreign, 301–302, 308–311, 312–314, 354 multi-column, 289, 316 numeric vs non-numeric, 289 primary, 288–290, 292 KeywordFilter property, 127 L Label control about, 15 adding in Design view, 184–185, 186 adding text using, 107, 110 namespace differences, 109 with Button control, 111 Language attribute (Page directive), 33, 212 language attribute (script tag), 34–35 language, specifying in Visual Web Developer, 162, 206 LEN function, 345 less than ([...]... controls in ASP. NET Appendix B: Deploying ASP. NET Websites Here you’ll be shown, step by step, how to use Visual Web Developer and how to move your website from your development environment to a web hosting service and make it live on the Internet It also covers tips for choosing a reliable web host, ASP. NET deployment gotchas, and hints for using the SQL Server Hosting Toolkit to migrate your database... the NET framework, introducing many new features that build upon its predecessor to improve performance, security, and interoperability with the latest browsers Best of all, it comes available with new development tools, including Visual Web Developer 2010 Express Edition and SQL 2 Build Your Own ASP. NET 4 Website Using C# & VB Server 2008 R2 Express Edition, both of which are free! These tools enable... somewhere, and starting with the web is a wise choice ASP. NET allows you to build dynamic websites, web applications and web services As a developer, you know and understand that there as many different types of web application as there are web applications themselves, and you need a powerful and flexible framework that will allow you to build them, without having to reinvent the wheel each time ASP. NET... transition to learning ASP. NET By the end of this book, you should be able to successfully download and install Visual Web Developer 2010 Express Edition, and use it to create basic ASP. NET pages You’ll also learn how to install and run Microsoft SQL Server 2008 R2 Express Edition, create database tables, and work with advanced, dynamic ASP. NET pages that query, insert, update, and delete information... of each technology and tool Let’s begin! What is ASP. NET? ASP. NET is a sophisticated and powerful web development framework If you’ve never used ASP. NET before, it’s likely to take you some time and patience to grow accustomed to it Development with ASP. NET requires not only an understanding of HTML and web design, but a firm grasp of the concepts of object oriented programming and development Fortunately,... Developer 2010 Express Edition and Microsoft SQL Server 2008 R2 Express Edition Finally, you’ll create a simple ASP. NET page to make sure that everything’s running and properly configured Chapter 2: ASP. NET Basics In this chapter, you’ll create your first useful ASP. NET page We’ll explore all the components that make up a typical ASP. NET page, including directives, controls, and code Then, we’ll walk... ask, some people answer, and most people do a bit of both Sharing your knowledge benefits others and strenghtens the community A lot of interesting and experienced web designers and developers hang out there It’s a good way to learn new stuff, have questions answered in a hurry, and generally have a blast The Book’s Website Located at http://www.sitepoint.com/books/aspnet4/, the website that supports... secure your web applications with ASP. NET We’ll discuss the various security models available, including IIS, Forms, Windows, and Windows Live ID, and explore the roles that the Web.config and XML files can play This chapter will also introduce you to the ASP. NET membership model and login controls Chapter 14: Working with Files and Email In this chapter, we’ll look at the task of accessing your server’s... presentation and more on your behalf This book provides you with everything you need to know to skill up in ASP. NET development with Web Forms technology It’s a fantastic learning tool, written in an approachable and informative way I strongly recommend you pick up your copy of this book, download the free Visual Web Developer Express tools, and start coding in ASP. NET You’ll be amazed at what you can build, ... 762 Appendix B Deploying ASP. NET Websites 763 ASP. NET Hosting Considerations 763 Using Visual Web Developer Express to Deploy ASP. NET Websites 764 Deploying MVC Sites and Web Applications 767 ASP. NET Deployment “Gotchas” 769 Using the SQL Server Hosting Toolkit

Ngày đăng: 30/05/2016, 00:10

TỪ KHÓA LIÊN QUAN