Http Handlers in ASP.NET
Authordate of SubmissionUser LevelSivakumar N08 / 24 / 2004InterMediate
Download: Examplehandler.rar 3KbIntroduction The low level Request and Response API to service incoming Http requests are Http Handlers in Asp.Net All handlers implement the IHttpHandler interface, which is located in the System.Web namespace Handlers are somewhat analogous to Internet Server.. Application Programming Interface (ISAPI) extensions. in this article, I will explain how to extend the functionality of web server by using Http handlers and How to protect files using Http handlers. Methods in Http HandlerThe following are the methods in Http handlers.
Method NamedescriptionProcessRequestused O Call Http Requests.Isreusableto Check The Reusability of Same Instance Handler with a New Request of Same Type.
Configuring http handlers
The
Creating HTTP Handlers To create an HTTP handler, you must implement the IHttpHandler interface The IHttpHandler interface has one method and one property with the following signatures:. Void ProcessRequest (HttpContext); bool IsReusable {get;} Customized Http HandlerBy customizing http handlers, new functionalities can be added to Web Server. Files with new extensions like .text for a text file can be handled by Web Server by using http handlers. The future of customization can lead to hosting .jsp pages in IIS by finding adequate ISAPI extensions. The following steps are involved to create customized http handler: 1 Create a C # class library as Hong xamplehandler br> 2. Name class as Sai andlerclass.cs / font> using System; using System.Web; using System.Web.SessionState.?? ; namespace ExampleHandler {/// Hello World from Handler"); objResponse.Write ( " body> html>");} public bool IsReusable {get {return true;}} # endregion}} Compile it and place it in the bin directory of TestApp project.Step 2Register this handler by adding the following Text in the Web.config File:
The Http Handlers are often useful when the services provided by the high-level page framework abstraction are not required for processing the HTTP request. Common uses of handlers include filters and CGI-like applications, especially those that return binary data.