Download Professional ASP.NET 4 in C# and VB Book in PDF, Epub and Kindle
This book was written to introduce you to the features and capabilities that ASP.NET 4 offers, as well as to give you an explanation of the foundation that ASP.NET provides. We assume you have a general understanding of Web technologies, such as previous versions of ASP.NET, Active Server Pages 2.0/3.0, or JavaServer Pages. If you understand the basics of Web programming, you should not have much trouble following along with this book's content. If you are brand new to ASP.NET, be sure to check out Beginning ASP.NET 4: In C# and VB by Imar Spaanjaars (Wiley Publishing, Inc., 2010) to help you understand the basics. In addition to working with Web technologies, we also assume that you understand basic programming constructs, such as variables, For Each loops, and object-oriented programming. You may also be wondering whether this book is for the Visual Basic developer or the C# developer. We are happy to say that it is for both! When the code differs substantially, this book provides examples in both VB and C#. This book explores the 4 release of ASP.NET. It covers each major new feature included in ASP.NET 4 in detail. The following list tells you something about the content of each chapter. Chapter 1, ″Application and Page Frameworks.″ The first chapter covers the frameworks of ASP.NET applications as well as the structure and frameworks provided for single ASP.NET pages. This chapter shows you how to build ASP.NET applications using IIS or the built-in Web server that comes with Visual Studio 2010. This chapter also shows you the folders and files that are part of ASP.NET. It discusses ways to compile code and shows you how to perform cross-page posting. This chapter ends by showing you easy ways to deal with your classes from within Visual Studio 2010. Chapters 2, 3, and 4. These three chapters are grouped together because they all deal with server controls. This batch of chapters starts by examining the idea of the server control and its pivotal role in ASP.NET development. In addition to looking at the server control framework, these chapters delve into the plethora of server controls that are at your disposal for ASP.NET development projects. Chapter 2, ″ASP.NET Server Controls and Client-Side Scripts,″ looks at the basics of working with server controls. Chapter 3, ″ASP.NET Web Server Controls,″ covers the controls that have been part of the ASP.NET technology since its initial release and the controls that have been added in each of the ASP.NET releases. Chapter 4, ″Validation Server Controls,″ describes a special group of server controls: those for validation. Chapter 5, ″Working with Master Pages.″ Master pages provide a means of creating templated pages that enable you to work with the entire application, as opposed to single pages. This chapter examines the creation of these templates and how to apply them to your content pages throughout an ASP.NET application. Chapter 6, ″Themes and Skins.″ The Cascading Style Sheet files you are allowed to use in ASP.NET 1.0/1.1 are simply not adequate in many regards, especially in the area of server controls. This chapter looks at how to deal with the styles that your applications require and shows you how to create a centrally managed look-and-feel for all the pages of your application by using themes and the skin files that are part of a theme. Chapter 7, ″Data Binding.″ One of the more important tasks of ASP.NET is presenting data, and this chapter looks at the underlying capabilities that enable you to work with the data programmatically before issuing the data to a control. Chapter 8, ″Data Management with ADO.NET.″ This chapter presents the ADO.NET data model provided by ASP.NET, which allows you to handle the retrieval, updating, and deleting of data quickly and logically. Chapter 9, ″Querying with LINQ.″ The.NET Framework 4 includes a nice access model language called LINQ. LINQ is a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. This chapter introduces you to LINQ and how to effectively use this feature in your Web applications today. Chapter 10, ″Working with XML and LINQ to XML.″ The .NET Framework and ASP.NET 4 have many capabilities built into their frameworks that enable you to easily extract, create, manipulate, and store XML. This chapter takes a close look at the XML technologies built into ASP.NET and the underlying .NET Framework. Chapter 11, ″Introduction to the Provider Model.″ The provider model is built into ASP.NET to make the lives of developers so much easier and more productive than ever before. This chapter gives an overview of this provider model and how it is used throughout ASP.NET 4. Chapter 12, ″Extending the Provider Model.″ After an introduction of the provider model, this chapter looks at some of the ways to extend the provider model found in ASP.NET 4. This chapter also reviews a couple of sample extensions to the provider model. Chapter 13, ″Site Navigation.″ Most developers do not simply develop single pages—they build applications. One of the application capabilities provided by ASP.NET 4 is the site navigation system covered in this chapter. Chapter 14, ″Personalization.″ Developers are always looking for ways to store information pertinent to the end user. After it is stored, this personalization data has to be persisted for future visits or for grabbing other pages within the same application. The ASP.NET team developed a way to store this information—the ASP.NET personalization system. The great thing about this system is that you configure the entire behavior of the system from the web.config file. Chapter 15, ″Membership and Role Management.″ This chapter covers the membership and role management system developed to simplify adding authentication and authorization to your ASP.NET applications. This chapter focuses on using the web.config file for controlling how these systems are applied, as well as on the server controls that work with the underlying systems. Chapter 16, ″Portal Frameworks and Web Parts.″ This chapter explains Web Parts—a way of encapsulating pages into smaller and more manageable objects. Chapter 17, ″HTML and CSS Design with ASP.NET.″ Visual Studio 2010 places a lot of focus on building a CSS-based Web. This chapter takes a close look at how you can effectively work with HTML and CSS design for your ASP.NET applications. Chapter 18, ″ASP.NET AJAX.″ AJAX is an acronym for Asynchronous JavaScript and XML. In Web application development, it signifies the capability to build applications that make use of the XMLHttpRequest object. Visual Studio 2010 contains the ability to build AJAX-enabled ASP.NET applications from the default install of the IDE. This chapter takes a look at this way to build your applications. Chapter 19, ″ASP.NET AJAX Control Toolkit.″ Along with the capabilities to build ASP.NET applications that make use of the AJAX technology, a series of controls is available to make the task rather simple. This chapter takes a good look at the ASP.NET AJAX Control Toolkit and how to use this toolkit with your applications today. Chapter 20, ″Security.″ This chapter discusses security beyond the membership and role management features provided by ASP.NET 4. This chapter provides an in-depth look at the authentication and authorization mechanics inherent in the ASP.NET technology, as well as HTTP access types and impersonations. Chapter 21, ″State Management.″ Because ASP.NET is a request-response–based technology, state management and the performance of requests and responses take on significant importance. This chapter introduces these two separate but important areas of ASP.NET development. Chapter 22, ″Caching.″ Because of the request-response nature of ASP.NET, caching (storing previous generated results, images, and pages) on the server becomes rather important to the performance of your ASP.NET applications. This chapter looks at some of the advanced caching capabilities provided by ASP.NET, including the SQL cache invalidation feature which is part of ASP.NET 4. This chapter also takes a look at object caching and object caching extensibility. Chapter 23, ″Debugging and Error Handling.″ This chapter tells you how to properly structure error handling within your applications. It also shows you how to use various debugging techniques to find errors that your applications might contain. Chapter 24, ″File I/O and Streams.″ This chapter takes a close look at working with various file types and streams that might come into your ASP.NET applications. Chapter 25, ″User and Server Controls.″ Not only can you use the plethora of server controls that come with ASP.NET, but you can also use the same framework these controls use and build your own. This chapter describes building your own server controls and how to use them within your applications. Chapter 26, ″Modules and Handlers.″ This chapter looks at two methods of manipulating the way ASP.NET processes HTTP requests: HttpModule and HttpHandler. Each method provides a unique level of access to the underlying processing of ASP.NET, and each can be a powerful tool for creating Web applications. Chapter 27, "ASP.NET MVC." ASP.NET MVC is the latest major addition to ASP.NET and has generated a lot of excitement from the development community. ASP.NET MVC supplies you with the means to create ASP.NET using the Model-View-Controller models that many developers expect. ASP.NET MVC provides developers with the testability, flexibility, and maintainability in the applications they build. It is important to remember that ASP.NET MVC is not meant to be a replacement to the ASP.NET everyone knows and loves, but instead is simply a different way to construct your applications. Chapter 28, ″Using Business Objects.″ Invariably, you are going to have components created with previous technologies that you do not want to rebuild but that you do want to integrate into new ASP.NET applications. If this is the case, the .NET Framework makes incorporating your previous COM components into your applications fairly simple and straightforward. This chapter also shows you how to build .NET components instead of turning to the previous COM component architecture. Chapter 29, ″ADO.NET Entity Framework.″ The inclusion of the ADO.NET Entity Framework in ASP.NET makes mapping objects from the database to the objects within your code significantly simpler. Using Visual Studio 2010, you are able to visually design your entity data models and then very easily access these models from code allowing the ADO.NET Entity Framework to handle the connections and transactions to the underlying database. Chapter 30, ″ASP.NET Dynamic Data.″ This feature in ASP.NET 4 allows you to quickly and easily put together a reporting and data entry application from your database. You are also able to take these same capabilities and incorporate them into a pre-existing application. Chapter 31, ″Working with Services.″ This chapter reveals the ease not only of building XML Web services, but consuming them in an ASP.NET application. This chapter then ventures further by describing how to build XML Web services that utilize SOAP headers and how to consume this particular type of service. Another feature in ASP.NET, ADO.NET Data Services, allows you to create a RESTful service layer using an Entity Data Model. Using this capability, you can quickly set up a service layer that allows you to expose your content as AtomPub or JSON, which will allow the consumer to completely interact with the underlying database. Chapter 32, ″Building Global Applications.″ ASP.NET provides an outstanding way to address the internationalization of Web applications. Changes to the API, the addition of capabilities to the server controls, and even Visual Studio itself equip you to do the extra work required to more easily bring your application to an international audience. This chapter looks at some of the important items to consider when building your Web applications for the world. Chapter 33, ″Configuration.″ This chapter teaches you to modify the capabilities and behaviors of ASP.NET using the various configuration files at your disposal. Chapter 34, ″Instrumentation.″ ASP.NET gives you greater capability to apply instrumentation techniques to your applications. The ASP.NET Framework includes performance counters, the capability to work with the Windows Event Tracing system, possibilities for application tracing (covered in Chapter 23 of this book), and the most exciting part of this discussion—a health monitoring system that allows you to log a number of different events over an application's lifetime. This chapter takes an in-depth look at this health monitoring system. Chapter 35, ″Administration and Management.″ This chapter provides an overview of the GUI tools that come with ASP.NET today that enable you to manage your Web applications easily and effectively. Chapter 36, ″Packaging and Deploying ASP.NET Applications.″ So you have built an ASP.NET application—now what? This chapter takes the building process one step further and shows you how to package your ASP.NET applications for easy deployment. Many options are available for working with the installers and compilation model to change what you are actually giving your customers. Appendix A, ″Migrating Older ASP.NET Projects.″ This appendix focuses on migrating ASP.NET 1.x, 2.0, or 3.5 applications to the 4 Framework. Appendix B, ″ASP.NET Ultimate Tools.″ Based on Scott Hanselman's annual Tools pick blog posting, many of the tools here will expedite your development process and, in many cases, make you a better developer. Appendix C, ″Silverlight 3 and ASP.NET.″ Silverlight is a means to build fluid applications using XAML. This technology enables developers with really rich vector-based applications. Appendix D, "Dynamic Types and Languages." As of the release of ASP.NET 4, you can now build your Web applications using IronRuby and IronPython. This appendix takes a quick look at using dynamic languages in building your Web applications. Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.