This module covered the stateless nature of the http protocol, and some solutions to problems that lack of state creates when you try to customize the user's experience of your site.
You learned how to initialize and capture session variables in the Session object to maintain user information, with an eye towards using that information to customize your site for its visitors. We also reviewed the Server object, focusing on its URL-encode method for ensuring that user information passed through a URL
via "get" is properly formatted. Additionally, you learned how to incorporate one of ASP's components, the Advertisement Rotator.
Now that you have completed this module, you should be able to:
- Explain why the lack of "state" on the Web causes difficulty in retaining user data
- Explain how the Session object and session variables maintain user information throughout a site visit
- Describe and create a Global.asa file with common user start and end procedures
- Display a banner image or text that rotates through a series with the Advertisement Rotator component
- Explain how the Server object can URL encode data that includes a space or other character not allowed inside a URL
ASP.NET Web API provides a highly-extensible, simpler processing pipeline.
For example, delegating handlers (also known as handlers
) and filters are mechanisms providing pre- and post-processing capabilities.
Handlers allow you to execute custom code prior to any controller being activated within the application. In fact, handlers can be configured to handle routes that have no corresponding controller. Filters are essentially classes that contain a few methods allowing you to run some code before and after specific controller methods are invoked.
These come in a few different flavors:
- action filters,
- authorization filters, and
- exception filters.
These filters take the form of attributes, and they are either decorated on specific controller methods, decorated on the controllers themselves, or configured globally for all methods. It is a bit tough to describe, but once you write and debug a few controllers, along with a delegating handler and some action filters, you will start noticing how clean and easy Microsoft has made this arrangement.
Nothing is hidden from you, making it simple to understand and step through an entire service call in the debugger.