Servlet-like content in ASP. NET

Source: Internet
Author: User

Scold Microsoft! Roar!

 

I started my website from JSP. Recently, my mentor asked me to use ASP. net to change a website, for Microsoft's a set of solutions, the heart is very uncomfortable, the most uncomfortable is that Microsoft wrapped their own website controls, called Web controls, despise!

But fortunately, Microsoft retains the basic HTML controls. Ajax is even more disgusting! In general, you need to use Microsoft's Ajax control and despise it again!

Today, when I read ASP. net3.5 from entry to proficiency, I found that the Ajax controls provided by Microsoft are more and more difficult to see and eager to search for my own Ajax framework on the Internet.ArticleAnd finally found:

Innovation comes from understanding how to easily build your own Ajax framework

Http://tech.ddvip.com/2007-05/118007547225691.html

I found that the ihttphandler interface is used, and I checked the msdn of vs2008. The followingCodeIn this example, four lines of text are written to the HTTP output stream in response to the client's request for a page named handler. aspx. For handler. aspx
All requests are included inProgramNamespace in handlertest. dllHandlerexampleIn
MyhttphandlerClass provides services:

// Name this C # file handlertest. CS and compile it with the <br/> // command line: CSC/T: Library/R: system. web. DLL handlertest. CS. <br/> // copy handlertest. DLL to your/bin directory. <br/> using system. web; <br/> namespace handlerexample <br/>{< br/> public class myhttphandler: ihttphandler <br/>{< br/> // override the processrequest method. <br/> Public void processrequest (httpcontext context) <br/>{< br/> context. response. write ("<p> This is an httphandler test. </p> "); <br/> context. response. write ("<p> your browser: </P>"); <br/> context. response. write ("type:" + context. request. browser. type + "<br>"); <br/> context. response. write ("version:" + context. request. browser. version); <br/>}< br/> // override the isreusable property. <br/> Public bool isreusable <br/>{< br/> get {return true ;} <br/>}< br/>/* <br/> ______________________________________________________ <br/> to use this handler, include the following lines in a web. config file. <br/> <configuration> <br/> <system. web> <br/> <pttphandlers> <br/> <add verb = "*" Path = "handler. aspx "type =" handlerexample. myhttphandler, handlertest "/> <br/> </pttphandlers> <br/> </system. web> <br/> </configuration> <br/> */<br/>

Combined

 

Innovation comes from understanding how to easily build your own Ajax framework

Http://tech.ddvip.com/2007-05/118007547225691.html

It is found that you can implement ihttphandler and then modify the web. the config method implements the servlet function. ihttphandler must compile it into a DLL file and store the file in the bin folder of the website. The DLL file is equivalent to a Servlet File and modifies the web. the config file can complete servlet ing.

 

For more information about modifying the Web. config file, see the http://msdn.microsoft.com/zh-cn/library/7d6sws33 (vs.80). aspx online msdn

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.