Get an insight into the ASP. Life cycle and event handling mechanisms

Source: Internet
Author: User

Just contacted the ASP. How his rapid development was realized. How the state of the control is maintained. We all know that HTTP is stateless. And many people on the web say that using the ASP. Server framework is very slow.

With these questions, let's look at the ASP.

Let's start with a brief look at the implementation process of the ASP.

What happens when a browser sends a request, such as requesting a index.aspx page?

1. First the client will organize the request message to the IIS server

The 2.iis server finds the corresponding handler through the file suffix to the Extender map, which is the ASP.NET_ISAPI (in Classic mode case)

3. Through this procedure, the request message is sent to the ASP. The first thing to deal with is the Httpruntime.processrequset method (hereafter we are referred to as PR method)

(1) This will parse the request message and encapsulate (2) simultaneously create the context object initialization related property (Httprequset,httpresponse,seeson)

4. Then create a Httpaplication object from the Httpaplicationfactory factory class This object is primarily to manage our event pipeline

5. Call the PR method of the Httpaplicaton object to pass HttpContext in and execute our event pipeline

6. The event pipeline has 22 events but we just need to focus on 19.

7 the 8th pipe to the Nineth pipe is created by parsing our foreground page class (our page compiles a class inheritance relationship < background page class <page) and then saves him to the remaphandler-attribute of the context's Ihttphander type

8. The 9th event is determined by determining whether the REMAPHANDELR implements the IRequiresSessionState interface if implemented, by reading the SessionID in the cookie to know the corresponding session object in the session pool

Assigns a value to the context of the session property. (The doubts here have been enlightened.) Why do general handlers need to implement this interface manually to use the session)

9.11th to 12th events call REMAPHANDELR's PR method, which is equivalent to 2 branches.

(1) First, let's compare the page classes that use server controls and the page classes that do not use server controls

No use of server control pages

Let's take a look at the page that uses the server control

From here we can make a simple comparison

Using server controls We know that the end result is to make the control object (and we know that creating the object is time consuming)

Pages that do not use server controls just write HTML to response other extra actions are not done

I wrote it here today.

Get an insight into the ASP. Life cycle and event handling mechanisms

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.