Differences between general processing programs (ashx) and page processing programs (aspx)

Source: Internet
Author: User

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.

Related Article

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.