Programming ASP (1)-ASP. WebForms

Source: Internet
Author: User

HTTP request:

The browser requests url--> to the IP address via DNS and the browser opens a socketthat connects to port 80 of the IP-referred server.

Request message:
Get/default.aspx http/1.1 (plus get, PUT, delete, etc.)
Host:www.mycloud.com (header: HTTP header)
User-agent: (Identifies the type of browser that made the request)
Connection: (Close connection or keep existing connection valid)
If-modified-since: (provides client-side cache authentication)

HTTP response:

Contains a status line and several headers

http/1.1 OK (status line: Includes message Protocol version and Status code)
server:microsoft-iis/6.0
Content-type:text/html (this type is represented by a given MIME type (text/html))
Content-length:55

The empty line between the last header and the HTTP response content is not just for formatting--carriage return and line feeds are essential, and are one of the most important things in the schema.

building the server-side abstraction Layer :

Each session between the browser and the Web server will cause the interaction of the packet (packet) message, similar to what we discussed earlier. If the requested URL is an HTML page, the Web server typically reads the contents of the. html file and flushes it into the body of the (flush) response message. If the URL is an ASP. NET page, a special IIS module is involved. This module is an IIS ISAPI plug-in that is called an "ISAPI extension."

An ISAPI extension is a dynamic-link library (DLL) that is registered as an extension of a file . Whenever there is a request for an. aspx file, you need to have an ISAPI extension that handles this type of file (Resource). This ISAPI extension parses the request and configures the server-side environment to actually process the page. If the state of the request is successfully obtained and fully restored, the page is allowed to run and output the desired result.

Submit form:

The <form> tag of HTML is the only tag that is authorized to submit client data to the server side. By design, when a user clicks a button of type "Submit", the browser populates the current contents of all controls that belong to the form (form) into a string. The string is then passed to the server as part of a GET or post instruction, based on the properties set by the <form> tag (attribute).

The following HTML fragment gives a simple form that contains only a text box and a Submit button. As you can see, this form associates the post instruction with the Default.aspx URL:

<formMethod= "POST"Action= "default.aspx">    <inputtype= "text"name= "Empcode" />    <inputtype= "Submit"value= "Send" /></form>

The following request shows the Web server Post command submitted when the user enters employee code 1001 and clicks the Submit button:

Post/default.aspx http/1.1
Host:www.contoso.com
content-type:application/x-www-form-urlencoded
Content-length:12
empcode=1001

During the process of processing a page request, the ISAPI extension parses the request body and exposes all the request information that is available through the object model that is convenient for the programmer. For example, the Empcode variable is no longer a simple key/value pair, but instead is converted to an application-level collection (Request.Form collection). The collection represents the first layer of abstraction established on top of the original HTTP programming model . Objects such as Request, Response , and Server make up the HTTP context of the call, and they represent the smallest set of objects currently in most web development platforms, including JSPs and ASP. Asp. NET objects are much more.

Programming ASP (1)-ASP. WebForms

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.