MCAD/MCSD: Implementing Navigation for the User Interface
This chapter covers the following Microsoft-specified objectives for the "Creating User Services" section of Exam 70-315, "Developing and Implementing Web Applications with Microsoft Visual C# .NET and Microsoft Visual Studio .NET":
Implement navigation for the user interface.
Manage the view state.
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 Hypertext Transfer Protocol (HTTP). Because of the stateless nature of the HTTP, Web applications are 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 easily maintain the state of a page across a page postback or between page navigations. 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 such as HttpResponse, HttpRequest, HttpSessionState, HttpServerUtility, and HttpApplicationState that give you methods and properties for accessing the underlying Web application's framework. You can easily access the objects 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 various important properties and methods of these objects.
- Roundtrip 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
- Hidden Fields
- View State
- View State 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
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 new features of ASP.NET such as view state and smart navigation that enhance the user experience for a Web page.
Use Response.Redirect(), Server.Transfer(), and Server.Execute() methods 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 various Web development tasks.
Development of Web applications is a different game compared to developing Windows applications. One of the major challenges that a Web developer faces while developing a Web application is the disconnected nature of Web application. Traditionally, programmers had to write a lot of 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 so that developers 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 as well as 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 fulfill various common Web development requirements.
Finally, I'll use the intrinsic objects to demonstrate various methods 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.