Microsoft ASP.NET Web Matrix Starter Kit
暫譯: Microsoft ASP.NET Web Matrix 入門套件

Mike Pope

  • 出版商: MicroSoft
  • 出版日期: 2003-03-03
  • 售價: $1,360
  • 貴賓價: 9.5$1,292
  • 語言: 英文
  • 頁數: 400
  • 裝訂: Paperback
  • ISBN: 0735618569
  • ISBN-13: 9780735618565
  • 相關分類: .NETASP.NET
  • 已絕版

買這商品的人也買了...

商品描述

 

Summary

Unlock the power of programmed, data-driven Web pages!

Have you ever gone to a great Web site and said to yourself, “I sure wish I could do that!” This hands-on book shows you exactly how. It’s a task-oriented, no-frills introduction, specifically for programming novices, to the cool world of programming the Web by using the power of Microsoft® ASP.NET Web Matrix—an easy-to-use WYSIWYG development tool for ASP.NET. You’ll go from merely posting text and graphics on a site to creating dynamic slideshows, reading and writing cookies, building interactive guestbooks and calendars, and developing other exciting Web features, all with intuitive yet powerful tools. Along the way, you’ll discover how to create programmed, data-driven Web pages for your home, hobby, or business in practically no time at all.

Topics covered include:

• Getting started: Introduction to server-based Web programming, Microsoft ASP.NET, Microsoft Visual Basic® .NET, and ASP.NET Web Matrix; and configuring ASP.NET, ASP.NET Web Matrix, and Microsoft SQL Server™ Desktop Engine (MSDE 2000)

• Basic techniques: Your first Web Forms page, creating a simple slideshow, getting and applying user preferences, creating a random quotes page, and displaying a hit counter

• More advanced techniques: Introduction to programming Web pages with data using ASP.NET Web Matrix, creating a guestbook and displaying formatted guestbook listings, creating a database-driven slideshow, updating master-detail tables, creating a calendar application, and sending e-mail notices automatically from a Web page

• Appendixes: Security vulnerabilities, good security practices, and your Web application; and deploying your application to a server

Table of Contents

Acknowledgments xiii
Introduction xv
PART I   INTRODUCTION TO WEB MATRIX AND ASP.NET  
1   What Does Web Programming Mean, Anyway? 3
    Server As Processor, Page as Program 4
        Where Microsoft ASP.NET Fits In 6
    Characteristics of Server-Based Web Programming 7
        Postbacks and Round Trips 8
        The Disconnected Web 8
        Each Page Is New 9
        Web Amnesia: Stateless Pages 9
    Browser-Based Programming 10
        Browser Compatibility 12
2   Overview of Web Matrix, ASP.NET, and Visual Basic .NET 15
    Web Programming and ASP.NET 15
    A Peek Inside the .NET Framework 17
    Web Matrix: Enabling Web Programming for the Rest of Us 18
        Web Matrix and Community 19
    Using Visual Basic .NET with Web Matrix 20
    Basics of Visual Basic .NET 23
        Object-Oriented Programming (OOP) 23
3   Getting Ready to Program with ASP.NET and Web Matrix 29
    Working with ASP.NET Web Pages 29
    Options for Testing and Running ASP.NET Web Pages 30
        Working with ISPs 30
        Finding an ASP.NET-Friendly Hosting Site 31
        Hosting the Site Yourself 31
    Providing Data Access for Your Web Pages 33
    Installing and Configuring the Required Software 33
        Installing Windows 34
        Setting Permissions for a Web Site 34
        Installing IIS 35
        Installing Internet Explorer 35
        Installing the .NET Framework 36
        Installing Web Matrix 37
        Installing MSDE 2000 37
PART II   LEARNING THE BASICS OF PROGRAMMED WEB PAGES  
4   Getting to Know Web Matrix 43
    Before You Start 43
    Looking Around the Web Matrix Development Environment 46
    Adding Text and Controls to the Page 49
    Working with Different Views of a Document 50
    Positioning Text and Elements 51
        Absolute Positioning 51
        Controlling the Grid 53
    Setting Properties for Controls 55
    Programming the Button 57
    Testing the Page 57
    Examining How Event Handlers Work 59
    Reviewing Round Trips and Postback 61
    Rendering Controls 61
5   Creating a Simple Slideshow 65
    How the Slideshow Works 65
    Got Pictures? 66
    Creating the Page 66
        Building the Slide List 68
        Loading the Slide List and Initializing the Page 69
    Testing the Page 70
    Adding Slide Navigation 71
        Maintaining the Slide Number in Viewstate 71
        Programming the Next and Previous Buttons 74
    Adding a Navigation Bar 77
    Adding Captions to the Slideshow 80
6   Maintaining User Preferences 85
    Creating the Preferences Page 86
        Populating the DropDownList Control 88
    Programming the Preview Button 91
        Turning Captions On and Off 91
        Previewing the Current Color 92
        Previewing the Font 93
        Reviewing the Preview Handler 94
        Testing the Preview Button 95
    Saving the Preferences 95
        About Cookies 95
        Programming the Save Preferences Button 96
    Displaying the Slideshow Page 97
    Reading the Preferences 98
        Reading the Cookie and Setting Values 98
    Linking Back to the Preferences Page 100
    Adding the Immediate Preview Feature 101
7   Creating a Random Quotes Page 103
    Creating the Quotations Text File 104
    Creating the Quotations Page 105
        Finding the Quotations File 107
        Reading the Quotations File 107
    Defensive Coding: Error Handling 109
    Generating a Random Number 110
    Getting and Displaying the Quotation 111
    Testing the Page 113
    Caching the Quotations When the Application Starts 114
8   Creating a Page Hit Counter 117
    Counting Visitors to Your Pages 117
    What Is a Hit? 119
    Tracking Unique Hits 120
    Creating a Page That Counts Hits 121
    Creating the Counter Logic 123
        Getting the Current Counter 125
        Checking the Cookie and Incrementing the Counter 126
        Displaying the Counter 128
    Testing the Counter 130
    Creating Graphical Numbers 131
        Creating the Graphics Files 132
        Displaying the Graphical Numbers 134
PART III   PROGRAMMING WEB PAGES WITH DATA  
9   Show Me the Data! 139
    Using Databases with Your Web Applications 139
    Getting Acquainted with ASP.NET Data Access Objects 141
        Understanding the Connection Object 142
        Understanding the Command Object 143
        Understanding the Data Reader Object 144
    Preserving Data During Round Trips 145
        About Data Binding 146
    Creating a Database in Web Matrix 146
        Creating the Database 147
    Creating a Simple Data-Display Page 153
    Customizing the Data-Display Grid 155
    Examining Data Components in the Page 156
10   Creating a Guestbook 159
    Creating the Guestbook Database Table 160
    The Guestbook Page 163
        Creating Code to Add a Guestbook Entry to the Database 164
        Sending the Visitor’s Input to the Database 167
    Creating a Simple Guestbook Listing 170
    Validating User Input 173
        Understanding Validator Controls 174
        Adding Validation to the Guestbook 176
11   Creating a More Flexible Guestbook Listing 183
    Overview of Templates and Data Binding 183
    Creating a Second Guestbook Listing Page 187
    Binding Controls 191
    Defining Additional Templates 194
    Programming the DataList Control 195
    Testing the Page 196
    Adding an Alternating Template 197
        Examining Templates in HTML View 198
        Examining Data Binding 199
    Working with the Repeater Control 201
12   Creating a Database-Driven Slideshow 205
    Collecting Pictures for the Slideshow 206
    The Slideshow Database Structure 207
    Creating the Slideshow Tables 209
    Creating a Slideshow Picker Page 212
    Programming the Slideshow Picker Page 214
    Data and State Management 216
        Understanding Datasets 217
        Caching Data in the Session Object 218
    Creating the Slideshow Viewer Page 219
    Programming the Slideshow Viewer Page 221
        Programming the Dataset 222
        Displaying the Current Slide 226
        Navigating Between Slides 228
        Testing the Slideshow Viewer Page 229
13   Updating Master-Details Tables 231
    Creating the Slideshows Master Page 232
        Inserting Slideshow Records into the Database 235
        Navigating to the Details Page 238
    Creating the Slide Details Page 240
        Reading the Slideshow Name from the Master Page 242
        Inserting Individual Slides into the Database 243
        Displaying Slides for the Current Slideshow 245
        Deleting Existing Slides 248
        Editing Existing Slides 250
        Programming the Edit Buttons to Update the Database 252
        Testing Editing Capabilities 255
    Maintaining Master-Details Integrity 256
14   Creating a Web-Based Calendar 259
    Creating the Calendar Database Table 260
    Creating a Calendar Entry Page 261
        Programming Date Selection with the Calendar 264
        Adding a Calendar Record to the Database 265
    Creating a Page to View the Calendar 268
        Highlighting Appointment Days in the Calendar 269
        Displaying Appointment Details 272
15   Sending E-Mail Messages from Your Web Application 277
    Configuring an E-Mail Server 278
        How the SMTP Virtual Server Works 278
        Installing and Configuring the SMTP Virtual Server 279
    Creating a Simple Page to Send E-Mail Messages 285
        Creating Code to Send E-Mail Messages 288
    Sending E-Mail Alerts from Your Guestbook 291
    Allowing Users to E-Mail Pictures from Your Slideshows 294
        Adding a Send This Picture Button to the Slideshow 295
        Creating a Page for Sending the Picture 296
        Adding Code to Display the Picture 298
        Adding Code to Send the Picture as an E-Mail Attachment 299
        Testing the Send Picture Page 300
PART IV   APPENDIXES  
A   Security and ASP.NET Web Applications 305
    Protecting Your Computer 307
        Restricting Access to Your Computer 307
        Restricting Access to Resources on the Computer 308
        Staying on Top of Security 309
        General Recommendations 310
    Securing Your Web Applications 310
        Understanding the ASPNET Account 310
        Protecting Against Malicious User Input 312
        Guarding Secrets 314
        Authenticating Users 315
        Accessing Databases Securely 317
    Thinking Securely 320
B   Deploying Web Matrix Applications 321
    Deploying Web Pages on a Local Web Site 321
        Configuring IIS for a Local Web Site 322
        Configuring Database Access for a Local Web Site 324
    Deploying Web Pages to a Hosting Site 325
        Copying Web Pages to a Hosting Site 325
        Copying Database Tables to a Hosting Site 328
GLOSSARY 337
INDEX 345

商品描述(中文翻譯)

摘要

釋放程式化、數據驅動的網頁的力量!

你是否曾經造訪一個很棒的網站,心中想著:「我真希望我也能做到那樣!」這本實作導向的書籍正是為了讓你了解如何做到這一點。這是一本針對程式設計新手的簡單介紹,帶你進入使用 Microsoft® ASP.NET Web Matrix 的網頁程式設計世界——這是一個易於使用的 WYSIWYG 開發工具。你將從僅僅在網站上發布文字和圖形,轉變為創建動態幻燈片、讀取和寫入 cookies、建立互動式留言簿和日曆,以及開發其他令人興奮的網頁功能,所有這些都可以使用直觀而強大的工具來完成。在這個過程中,你將發現如何在幾乎沒有時間的情況下,為你的家庭、愛好或業務創建程式化的數據驅動網頁。

涵蓋的主題包括:

• 開始:伺服器端網頁程式設計、Microsoft ASP.NET、Microsoft Visual Basic® .NET 和 ASP.NET Web Matrix 的介紹;以及配置 ASP.NET、ASP.NET Web Matrix 和 Microsoft SQL Server™ Desktop Engine (MSDE 2000)

• 基本技術:你的第一個 Web Forms 頁面、創建簡單的幻燈片、獲取和應用用戶偏好、創建隨機名言頁面和顯示點擊計數器

• 更高級的技術:使用 ASP.NET Web Matrix 程式化數據的網頁介紹、創建留言簿並顯示格式化的留言簿列表、創建數據驅動的幻燈片、更新主詳細表、創建日曆應用程式,以及自動從網頁發送電子郵件通知

• 附錄:安全漏洞、良好的安全實踐以及你的網頁應用程式;以及將你的應用程式部署到伺服器

目錄

致謝

導言

第一部分 介紹 Web Matrix 和 ASP.NET

1 網頁程式設計到底是什麼?

伺服器作為處理器,頁面作為程式

Microsoft ASP.NET 的位置

伺服器端網頁程式設計的特徵

回傳和往返

斷開連接的網路

每個頁面都是新的

網路失憶:無狀態頁面

基於瀏覽器的程式設計

瀏覽器相容性

2 Web Matrix、ASP.NET 和 Visual Basic .NET 概述

網頁程式設計和 ASP.NET

.NET 框架內部一瞥

Web Matrix:為我們其他人啟用網頁程式設計

Web Matrix 和社群

使用 Visual Basic .NET 與 Web Matrix

Visual Basic .NET 的基礎

物件導向程式設計 (OOP)

3 準備使用 ASP.NET 和 Web Matrix 程式設計

使用 ASP.NET 網頁

測試和運行 ASP.NET 網頁的選項

與 ISP 合作

尋找 ASP.NET 友好的主機網站

自己托管網站

為你的網頁提供數據訪問

安裝和配置所需的軟體

安裝 Windows

為網站設置權限

安裝 IIS

安裝 Internet Explorer

安裝 .NET 框架

安裝 Web Matrix

安裝 MSDE 2000

第二部分 學習程式化網頁的基礎

4 認識 Web Matrix

在開始之前

瀏覽 Web Matrix 開發環境

向頁面添加文本和控件

處理文檔的不同視圖

定位文本和元素

絕對定位

控制網格

為控件設置屬性

編程按鈕

測試頁面

檢查事件處理程序的工作原理

回顧往返和回傳

渲染控件

5 創建簡單的幻燈片

幻燈片的工作原理

有圖片嗎?

創建頁面

構建幻燈片列表

加載幻燈片列表並初始化頁面

測試頁面

添加幻燈片導航

在 ViewState 中維護幻燈片編號

編程下一個和上一個按鈕

添加導航欄

為幻燈片添加標題

6 維護用戶偏好

創建偏好頁面

填充 DropDownList 控件

編程預覽按鈕