Implementing Navigation for the User Interface
Objectives
This Appendix Covers the following Microsoft-specified objectives for the "Creating User Services" section of Exam 70-305, "Developing and Implementing Web Applications with Microsoft Visual Basic .NET and Microsoft Visual Studio .NET":
Implement navigation for the user interface.
Manage the ViewState.
Manage data during postback events.
Use session state to manage data across pages.
The underlying protocol for communication between the Web browser and Web server is HTTP. Because of the stateless nature of the HTTP protocol, Web applications are also stateless. Traditionally, this has been one of the major challenges for developing rich and interactive Web applications.
ASP.NET provides several features that help you in easily maintaining the state of a page across a page postback or during navigation. This exam objective requires you to know the various ways in which you can manage state using ASP.NET. In addition to this, you should also know the various ways in which you can navigate from one page to another in a Web application.
Use and edit intrinsic objects. Intrinsic objects include response, request, session, server, and application.
Retrieve values from the properties of intrinsic objects.
Set values on the properties of intrinsic objects.
Use intrinsic objects to perform operations.
ASP.NET provides several classes, including HttpResponse, HttpRequest, HttpSessionState, HttpServerUtility, and HttpApplicationState that give you method and properties to access the underlying Web application's framework. You can easily access the object of these classes for the current HTTP request using the properties of the Page class such as Response, Request, Session, Server, and Application. This exam objective requires you to know about the various important properties and methods of these objects.
Outline
- Introduction
- Round Trip and Postback
- The IsPostBack Property
- The SmartNavigation Property
- ASP.NET Intrinsic Objects
- The HttpRequest Object
- The HttpResponse Object
- The HttpServerUtility Object
- ASP.NET Application
- The Global.asax File
- Global Event Handlers
- Application and Session Level Events
- Per-Request Events
- State Management
- Client-side Techniques for State Management
- Query Strings
- Cookies
- Hidden Fields
- ViewState
- ViewState for Page-level Values
- Choosing a Client-side State Management Technique
- Server-side Techniques for State Management
- Session State
- Application State
- Client-side Techniques for State Management
- Navigation Between Pages
- The Response.Redirect() Method
- The Server.Transfer() Method
- The Server.Execute() Method
- Chapter Summary
- Apply Your Knowledge
Study Strategies
Experiment with different techniques for state management. You should understand their differences, advantages, and disadvantages so that you know which technique to use in a given scenario.
Use the new features of ASP.NET such as ViewState and SmartNavigation to enhance the user experience for a Web page.
Use Response.Redirect(), Server.Transfer(), and Server.Execute() in your programs and understand their differences. Be prepared to choose an appropriate navigation method for a given scenario.
Know how to access and use various intrinsic objects from your Web Form. Use various properties and methods of these objects to understand how they can help you in Web development tasks.
Introduction
Developing Web application is a different activity from developing Windows applications. One of the major challenges that a Web developer faces while developing a Web application is the disconnected nature of Web applications. Traditionally, programmers had to write additional code to maintain state between page postback and navigation. ASP.NET provides a better model of programming by incorporating the tasks related to state management as part of the programming framework itself. This allows developers to spend less time in plumbing work and more on developing the actual business logic.
In this chapter, I'll present various state management features provided by ASP.NET. I'll discuss both client-side techniques and server-side techniques for state management.
I'll also discuss the ASP.NET intrinsic objects that are available to you via the Page class. You'll see how these objects can help you in various common Web development scenarios.
Finally, I'll use the intrinsic objects to demonstrate various ways that you can use to navigate from one page to another. I'll also compare various navigation techniques so that you can choose the appropriate technique for a given scenario.