"Asp.net4 from Beginner to Mastery" study Note 4

Source: Internet
Author: User

Part 4 Diagnostics and plugins

At the beginning of this chapter, the real confused, do not know what to say, but after reading about the HTTP pipeline, only to understand the relevant instructions. Therefore, for this chapter of the study, we recommend that you first look at HTTP pipeline and then to learn.

17th Chapter Diagnosis and Commissioning

This section explains the basic debugging methods, but personally think that the commissioning method actually involves many aspects of the content, this chapter is only about a few basic methods.

L START the Trace function on the page and then you can see the call status on the page.

In addition, you can modify Web.configtrace enable= "true" to achieve trace tracking for the entire system.

L Use Trace.Write trace.xsd interface to write specific commissioning information

L Visual Studio's single-step measurement function and power-down commissioning.

Another most important part is how to handle the page error, when the page error occurs, you can make the system jump to the specific error page, so that the better to provide user experience.

Specific methods:

L Modify the Customeerror field in the Web. config and then add the error filtering rules and pages to the page, so that after a specific error occurs, it jumps to the specific page.

L can intercept error in Applicaton_error, then redirect jump page or write log etc.

18th Chapter HttpApplication and HTTP modules

This chapter, when explained, did not add some basic knowledge, make the understanding of some confusion, here I first add some knowledge, and then go further.

Object:

HttpApplication: A global object that determines that an application contains those httpmodules and is used to trigger Application_Start class events.

HttpContext: Contains the full request context, usually using the current property

HttpResponse: Packing the response

HttpRequest: Packaging the request

State:

SessionState: Session state

ApplicationState: application-level status

Cachestate: Cache Status

This section is also about the pipeline of IIS handling HTTP requests, the basic flow is as follows:

After IIS obtains the request, it first loads and processes a series of processes, then processes each HttpModule, and then eventually handles the corresponding file in HttpHandler.

The essence of HttpModule is to perform different processes at different stages of application, such as validation, calculation, change, etc.

HttpModule writing, very simple, just need to integrate the IHttpModule interface can be, note is to write a class library program, and then the Web. config in the register, a basic HttpModule is done.

Session interface, you can have an interface, so HttpModule can use the session processing.

19th Chapter HttpHandler Treatment

In fact HttpHandler is to handle the request page, also say a file, such as ASPX should have corresponding handler to handle.

You do this by inheriting the IHttpHandler interface, and then modifying the Web. config to configure it, or configure it in IIS.

For simple VisualStudio also provides a ASHX general handler for the file, provides a very simple processing mode, this processing mode is required by the customer directly in the browser to access it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.