The Httphandler in the figure is the processing program. Microsoft has made great efforts to package aspx, including controls, viewstate, and its own lifecycle. To allow developers to better process requests, Microsoft uses an event mechanism to allow programmers to inject code in the aspx lifecycle class. Aspx is a version that is more complex than ashx. Let the user output some information when accessing 127.0.0.1/hello. zz and use it as a processing program. Create a new hanler. cs file in the app_code folder under the directory. The Code is as follows:
Context. Response. ContentType = context. Response. Write (}
Create handler. ashx in directory a. The Code is as follows:
<% @ WebHandler Language = Class =%> =
Create the following web. config
Special instructions:
Use vs2012 to open handler. ashx, right-click it, and use a browser. This is just to build a web environment.
Then request hello. zz.