applied asp.net 4 in context

932 1.7K 0
applied asp.net 4 in context

Đ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

www.it-ebooks.info CHAPTER 9: Super Jumper: A 2D OpenGL ES Game 488 For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.it-ebooks.info iv Contents at a Glance About the Author xxvii About the Technical Reviewer xxviii Acknowledgments xxix PART I: Getting Started 1 ■Chapter 1: Introduction 3 ■Chapter 2: Getting Ready 7 ■Chapter 3: Putting ASP.NET in Context 13 PART II: Getting to Know ASP .NET 19 ■Chapter 4: Working with Pages 21 ■Chapter 5: Working with Context and Events 51 ■Chapter 6: Working with Forms and State 77 ■Chapter 7: Handling Errors 105 ■Chapter 8: Working with Data 139 ■Chapter 9: Styling Content 181 ■Chapter 10: Adding Interactivity 205 ■Chapter 11: Working with Ajax 241 ■Chapter 12: Working with Routes 277 ■ CONTENTS AT A GLANCE v PART III: Using Web Forms 307 ■Chapter 13: Putting Web Forms in Context 309 ■Chapter 14: Working with the Web Forms Designer 317 ■Chapter 15: Working with Web Forms Controls 343 ■Chapter 16: Customizing Web Forms Controls 375 ■Chapter 17: Validating Form Data 405 ■Chapter 18: Using Web Forms Data Sources 427 ■Chapter 19: Using Web Forms Data Binding 459 ■Chapter 20: Using the Rich Data Controls 489 ■Chapter 21: The Web Forms Triathlon App 519 PART IV: Using the MVC Framework 551 ■Chapter 22: Putting MVC in Context 553 ■Chapter 23: A First MVC Application 561 ■Chapter 24: Implementing a Persistent Repository 593 ■Chapter 25: Working with Views 607 ■Chapter 26: Using HTML Helpers and Templates 639 ■Chapter 27: Using Routing and Areas 671 ■Chapter 28: Working with Action Methods 689 ■Chapter 29: Working with Model Binding and Validation 719 ■Chapter 30: Using Unobtrusive Ajax 743 ■Chapter 31: The MVC Framework Triathlon App 763 ■ CONTENTS AT A GLANCE vi PART V: Wrapping Up 807 ■Chapter 32: Preparing a Server for Deployment 809 ■Chapter 33: Deploying an ASP .NET Application 821 ■Chapter 34: Authentication and Authorization 847 Index 875 1 P A R T I ■ ■ ■ Getting Started Before you can begin to explore the ASP.NET framework, we have some preparation to do. In the next three chapters, I’ll describe the structure of the book, show you how to set up your workstation and server for ASP.NET development, and provide a high-level overview of how the various parts of the ASP.NET framework fit together. C H A P T E R 1 3 Introduction My first experience with ASP.NET wasn’t very positive. It was back in 2003, and I had agreed to write a book for Microsoft Press about using ASP.NET to create XML web services. This was when ASP.NET 1.0 was released. In those days, .NET was interesting but nothing special. It was widely regarded as Microsoft’s attempt to compete with Java, and the whole platform had a “me too” feel about it. ASP.NET itself was a very rigid and limited platform. It hadn’t been thought through and had a lot of rough edges. It was difficult to use, the tools support was lacking, and programmers had to work hard to get even the most basic functionality working. Most Microsoft products follow a standard pattern of evolution. Version 1 shows promise but is rushed out the door and has major flaws. It is more a statement of intent rather than something to bet on. Version 2 fixes the worst flaws and delivers more of the original promise. Version 3 starts to look polished, but there are breaking changes. Version 4 is a solid performer, which adds innovative features and has the capability to lead the market segment. This is the story of ASP.NET (and, of course, .NET as a whole). We are at the point where Microsoft excels: building on a solid and widely adopted product set to produce tools and features that shine. ASP.NET 4 is a very solid web application platform. It is packed with features, contains a choice of development frameworks, and has excellent tool support in Visual Studio. ASP.NET has reached maturity and is a platform to bet on. In this book, I’ll take you on a tour through ASP.NET, starting with the core platform features, moving on to the Web Forms and MVC framework development frameworks, and finishing with the information you need to know to successfully deploy an ASP.NET web application. As we go from chapter to chapter, you’ll learn everything you need to write effective ASP.NET web applications and understand how to solve the most commonly encountered web application challenges. Who Should Read This Book? This book was written for programmers who have some experience with C# and the .NET Framework and have a basic knowledge of web technologies such as HTML and HTTP. No prior knowledge of ASP.NET, Web Forms, or the MVC framework is required. You should have a basic familiarity with Visual Studio. CHAPTER 1 ■ INTRODUCTION 4 What Is Covered in This Book? This book covers the major features of ASP.NET version 4, including core platform features, Web Forms, and the MVC framework. The emphasis of this book is about applying ASP.NET. To that end, I cover the core features in depth and leave the more academic and theoretical coverage to other authors. This book is about getting things done with ASP.NET. What Is the Structure of This Book? There are five parts to this book. The first helps you get ready to use ASP.NET and to understand the building blocks of the ASP.NET platform. By the end of these chapters, you will have all the software you require installed and ready to go. Part II introduces the core features of the ASP.NET platform. You will learn how ASP.NET handles browser requests, how to create ASP.NET web pages, how to apply JavaScript to those pages, and how to create and consume web services. Part III covers Web Forms, a set of features designed to make developing web applications similar to developing traditional Windows programs. Web Forms has fallen out of favor lately, but it is a powerful and flexible system, and it is worth taking the time to read these chapters. Part IV covers the MVC framework, which is a relatively new addition to ASP.NET and which has stolen the limelight from Web Forms in the ASP.NET world. The MVC framework takes an approach to web application development that has a lot in common with platforms such as Ruby on Rails. Part V covers some advanced topics, including web application security and deployment. What Do You Need to Read This Book? To get the most benefit from this book, you should have a modern Windows PC, set up for .NET development. Chapter 3 gives you complete details of the software you will need. With the exception of Windows itself, Microsoft makes free-of-charge versions of every software component that this book requires. These free versions are suitable for following all the examples in this book, with the exception of some unit testing examples in Part IV (for which a paid-for edition of Visual Studio is required). Part V of this book includes examples of deploying an ASP.NET web application to a server. These tasks require a machine running Windows Server 2008 R2. These examples are optional. Many ASP.NET developers don’t need to deploy the application they create themselves since these tasks are handled by operations teams. Getting the Example Code The code for all the examples in this book is freely available for download from Apress.com. Most of the more substantial examples relate to triathlons. As I write this book, I am training for my first competitive triathlon, and I felt that these were better examples than the stock or employee tracking examples that programming books usually contain. CHAPTER 1 ■ INTRODUCTION 5 Finding More Information I have tried to cover everything important in ASP.NET, but there are bound to be aspects that interest you that I have left out. If that should be the case, then I recommend the resources described next. The MSDN Library The MSDN library contains a lot of useful information about ASP.NET, although the quality and depth can be patchy. The starting point for ASP.NET 4 is at http://msdn.microsoft.com/en-us/library/ ee532866.aspx. Online Forums Numerous web sites discuss ASP.NET. The one that seems to have the most knowledgeable participants and the lowest amount of useless noise is Stackoverflow.com. This site is not specific to ASP.NET, but there is a very active .NET and ASP.NET community, and when you get stuck, chances are someone has had the same problem and has already asked for help. Other Books I have written a couple of other books you might like to consider as complements to this one. I wrote a more traditional ASP.NET 4 reference with Matt MacDonald called Pro ASP.NET 4 in C# 2010. This is focused more on the Web Forms side of things but provides broad coverage. I also wrote Pro ASP.NET MVC 3 Framework with Steve Sanderson. Steve is a member of the Web Platform and Tools team at Microsoft, the group responsible for the MVC framework. Both of these books are published by Apress. Summary ASP.NET 4 is a fantastic platform for web development. The depth of functionality and the breadth of options are excellent, especially if you are moving to web application development from another area of .NET. As we go through this book, you’ll see just how rich the ecosystem is and how rapidly and easily we can create functional and robust web applications. C H A P T E R 2 7 Getting Ready We must do some preparation before we can start working with ASP.NET. In the following sections, I’ll tell you what you need. I have split the preparation into two sections. You’ll need to install a couple of additional components when you reach the part of the book that deals with the part of ASP.NET called the MVC framework. The rest of ASP.NET is installed as part of Visual Studio and .NET 4, but you need an update and an additional third-party library to get the best from the MVC framework. Installing Visual Studio 2010 The first step in preparing a workstation for development with ASP.NET is to install Visual Studio 2010. Visual Studio is Microsoft’s integrated development environment (IDE), a tool that you will most likely have used if you have done any prior development for a Microsoft platform. Microsoft produces a range of different Visual Studio 2010 editions, each of which has a different set of functions and attracts a different price. For this book, you will require one of the following editions: • Visual Studio 2010 Professional • Visual Studio 2010 Premium • Visual Studio 2010 Ultimate The features that we require are available in all three editions, and all three editions are equally suited to our purposes. Install Visual Studio as you would any Windows application and make sure that you have the latest updates and service packs installed. USING VISUAL WEB DEVELOPER EXPRESS Microsoft produces a set of light-weight versions of Visual Studio known as the Express editions. The Express edition for web application development is called Visual Web Developer 2010 Express. Microsoft differentiates the Express editions by removing some features, but you can still use Visual Web Developer to create ASP.NET applications. [...]... information about these classes, including the use of Response.Write, in Chapter 5 Adding and Calling Methods The code block in Listing 4- 3 is self-contained, but if we want to perform the same task in several different code blocks, we can define a common method and refer to it from different code blocks Listing 4- 4 demonstrates defining two methods Listing 4- 4 Defining methods in a dynamic web page . 1: Introduction 3 ■Chapter 2: Getting Ready 7 ■Chapter 3: Putting ASP. NET in Context 13 PART II: Getting to Know ASP .NET 19 ■Chapter 4: Working with Pages 21 ■Chapter 5: Working with Context. since the introduction of .NET. Many programmers have moved to C#, leaving the market segment for Visual Basic .NET much reduced. CHAPTER 3 ■ PUTTING ASP .NET IN CONTEXT 14 ASP. NET 1 introduced. have underpinned all versions of ASP. NET, including the most recent version, ASP. NET 4: • It has close integration with the .NET Framework: ASP. NET is very tightly bound to the .NET Framework,

Ngày đăng: 01/08/2014, 17:38

Mục lục

  • Cover

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

    • Who Should Read This Book?

    • What Is Covered in This Book?

    • What Is the Structure of This Book?

    • What Do You Need to Read This Book?

    • Getting the Example Code

    • Finding More Information

      • The MSDN Library

      • Online Forums

      • Other Books

      • Summary

      • Getting Ready

        • Installing Visual Studio 2010

        • Installing the Essential Software

        • Installing Optional Components

          • IIS Express

          • SQL Server 2008 R2 Management Studio Express

          • Getting Ready for the MVC Framework

            • Ninject

Tài liệu cùng người dùng

Tài liệu liên quan