System.Uri
Common Properties:
Scheme Protocol Name
Host hosts
Port ports
Absoultepath Absolute Path
The parameters section of the Queryuri address
URI (Universal Resource Identifier)
URL (Uniform Resource Locator)
A meaningful name for IP is the domain name, which is associated with the IP and domain name via DNS (domain name server)
Level of communication between programs and programs
1. Physical Layer
2. Data Link Layer
3. Network layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
The content of the application layer protocol needs to be transferred between the browser and the server via the transport layer
In TCP/IP
TCP Transport-layer protocol for reliable communication
IP is responsible for the network layer protocol
The HTTP protocol is the application layer protocol specifically used in the TCP/IP protocol for communication between the browser and the Web server.
On the same network address, in order to differentiate between different applications that use the same protocol, you can assign a numeric number to different applications, called Network ports (2 bytes) that are assigned by the IANA (Internet address assignment Authority) to these network ports
1.0-1023 is a well-known port
2.1024-49151 Register Port
3.49152-65535 Private Port
So how to implement a simple HTTP server?
1.SOCKET is based on the most primitive socket, that is the most powerful, of course, the most complex
2.TCPListener TCP-based, because HTTP is TCP/IP-based, further encapsulation of the socket
3.HttpListener TCP/IP-based, further encapsulation of the TcpListener
Common Properties:
Whether Issupport supports
Prefixes prefix
The minimum logical unit of Assembly management is the application domain (AppDomain)
> Application Domains
> Application Set
The four mechanisms of application
1. Isolation, which cannot be accessed between different application domains, objects that are accessed across application domains must derive fromSystem.MarshalByRefObject
2. Uninstall must be uninstalled in application domain after loading
3. Security with application domain as a boundary security mechanism
4. Configuring program configuration with application domain boundaries
WEB application domain
Static methods of the ApplicationHost classCreateapplicationhost(Type,virtualdir,physicaldir);
Unknown Worker object:
In ASP., the request that is prepared for processing must be encapsulated asHttpWorkerRequestType Object
SimpleWorkerRequest can handle simple requests and output the returned content to the TextWriter stream
The runtime of the Web application
>system.web.httpruntimeClass is the entire ASP. NET Server Processing Portal
>httpresponse
By default, HttpResponse buffers the output page
You can use the BufferOutput property to get
Redirection (Redirect) principle
Return Status code: 302
Set the response header ["Location"]= "Address"
>httprequest
>headers
>form
>cookies
>files
Auxiliary Common tool Class HttpServerUtility
A simple implementation of the ASP. NET Web server
1. You can get an HTTP connection via Simplehttplistener
2. After getting a connection, it is necessary to process the request, but here we do the direct processing, because it is not in the same application domain, so we point to it with a delegate
3. Create a cross-application domain object, inherit to System.MarshalByRefObject, create a method to process the request
4. Specify the entry for the ASP. In the method of processing the request, and pass the HttpRuntime. ProcessRequest (Httpworkrequest) method to get the result of the request
Chapter One website application