ASP.NET - What is Http Handler in ASP.NET

Asked By rajesh kumar
14-Dec-11 05:12 AM
Can any one explain about What is Http Handler in ASP.NET
  Suchit shah replied to rajesh kumar
14-Dec-11 05:14 AM

An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler. You can create your own HTTP handlers that render custom output to the browser.

An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life-cycle events throughout the request. HTTP modules let you examine incoming and outgoing requests and take action based on the request.

Built-in HTTP Handlers in ASP.NET

ASP.NET maps HTTP requests to HTTP handlers based on a file name extension. Each HTTP handler enables processing of individual HTTP URLs or groups of URL extensions within an application. ASP.NET includes several built-in HTTP handlers, as listed in the following table.

Handler Description

ASP.NET Page Handler (*.aspx)

The default HTTP handler for all ASP.NET pages.

Web service handler (*.asmx)

The default HTTP handler for Web service pages created using ASP.NET.

ASP.NET user control handler (*.ascx)

The default HTTP handler for all ASP.NET user control pages.

Trace handler (trace.axd)

A handler that displays current page trace information. For details, see http://msdn.microsoft.com/en-us/library/wwh16c6c(v=VS.80).aspx.

  Vickey F replied to rajesh kumar
14-Dec-11 05:14 AM
An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler. You can create your own HTTP handlers that render custom output to the browser.


An HTTP module is an assembly that is called on every request that is made to your application.

Follow this link for more help-

http://msdn.microsoft.com/en-us/library/bb398986.aspx
http://www.developerfusion.com/article/4643/implementing-http-handlers-in-aspnet/

Hope this will help you.
  Suchit shah replied to rajesh kumar
14-Dec-11 05:15 AM

An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page via the page handler.
 
The ASP.NET page handler is only one type of handler. ASP.NET comes with several other built-in handlers such as the Web service handler for .asmx files.
 
You can create custom HTTP handlers when you want special handling that you can identify using file name extensions in your application. For example, the following scenarios would be good uses of custom HTTP handlers:
 
RSS feeds   To create an RSS feed for a site, you can create a handler that emits RSS-formatted XML. You can then bind the .rss extension (for example) in your application to the custom handler. When users send a request to your site that ends in .rss, ASP.NET will call your handler to process the request.
 

Image server   If you want your Web application to serve images in a variety of sizes, you can write a custom handler to resize images and then send them back to the user as the handler's response.
 

HTTP handlers have access to the application context, including the requesting user's identity (if known), application state, and session information. When an HTTP handler is requested, ASP.NET calls the ProcessRequest method on the appropriate handler. The handler's ProcessRequest method creates a response, which is sent back to the requesting browser. As with any page request, the response goes through any HTTP modules that have subscribed to events that occur after the handler has run. For more information about the processing of Web server requests, see ASP.NET Application Life Cycle Overview.
 
An HTTP handler can be either synchronous or asynchronous. A synchronous handler does not return until it finishes processing the HTTP request for which it is called. An asynchronous handler runs a process independently of sending a response to the user. Asynchronous handlers are useful when you need to start an application process that might be lengthy and the user does not need to wait until it finishes before getting a response from the server.

  Sunil Darji replied to rajesh kumar
14-Dec-11 05:28 AM


The HttpHandler are used by ASP.NET to handle requests. Whenever the IIS Server recieves a request, it looks for an ISAPI filter that is capable of handling web requests. In ASP.NET, this is done by aspnet_isapi.dll. Same kind of process happens when an ASP.NET page is trigerred. It looks for HttpHandler in the web.config files for any request setting. As in machine.config default setting, the .aspx files are mapped to PageHandlerFactory, and the .asmx files are mapped to the WebServiceHandlerFactory. There are many requests processed by ASP.NET in this cycle, like BeginRequest, AuthenticateRequest, AuthorizeRequest, AcquireRequestState, ResolveRequestCache, Page Constructor, PreRequestHandlerExecute, Page.Init, Page.Load, PostRequestHandlerExecute, ReleaseRequestState, UpdateRequestCache, EndRequest, PreSendRequestHeaders, PreSendRequestContent.

 refer for description and example  ::  http://www.jigar.net/articles/viewhtmlcontent3.aspx 

 
  Suchit shah replied to rajesh kumar
14-Dec-11 05:31 AM

HttpHandlers have a specific use and are not used in every situation..

What is a HttpHandler?

Well a HttpHandler is used in situations where you need to "handle" the "http" request sent to your webserver in a specific or different manor. More over a Http Handler (which is the basis of all .Net managed handlers) opens up the RAW http request (and response) allowing for complete customization in dealing with the request and providing a customized response.

When you use a HttpHandler ?

A Http Handler (as said above) simply recieves and responds to a http request. Typically we use our .net (aspx) pages to handle and respond to these request. However when it comes to specific situations, IE. request for downloading a file, displaying a chart image etc... It is usually better to remove all the "un needed" events, data and sub routines required to show a full page. Http Handlers can also provide a low level access to events and data from all http requests. This allows you to "intercept" http requests and process data \ header information before your application processes the request.

  dipa ahuja replied to rajesh kumar
14-Dec-11 05:57 AM

ASP.NET request processing is based on a pipeline model in which ASP.NET passes http requests to all the HTTP modules in the pipeline. Each module receives the http request and has full control over it. The module can play with the request in any way it sees fit. Once the request passes through all of the HTTP modules, it is eventually served by an HTTP handler. The HTTP handler performs some processing on it, and the result again passes through the HTTP modules in the pipeline.

During the processing of an http request, only one HTTP handler will be called, whereas more than one HTTP modules can be called.

HttpHandlers

HTTP handlers are the .NET components that implement the System.Web.IHttpHandler interface. Any class that implements the IHttpHandler interface can act as a target for the incoming HTTP requests. HTTP handlers are somewhat similar to ISAPI extensions. It is commonly used for url rewriting and handling particular extension like '.merit' through asp.net.
you can Register the handler by adding the following text in the web.config file:

<httpHandlers>
<add verb="*" path="*.merit" type="MyHandler.NewHandler,MyHandler"/>
</httpHandlers>
<http://www.15seconds.com/issue/020417.htm>

 

  Anoop S replied to rajesh kumar
14-Dec-11 06:09 AM
ASP.NET HTTP Handlers are a new technique presented in ASP.NET that was not present in the "Classic" ASP. HTTP Handlers are components that implement the System.Web.IHttpHandler interface. Unlike ASP.NET Pages they have no HTML-markup file, no events and other supporting. All they have is a code-file (written in any .NET-compatible language) that writes some data to the server HTTP response.

ASP.NET handlers have ".ashx" file extension (unlike pages, that have ".aspx" file extension).

Handlers are considered to be more lightweight object than pages. That's why they are used to serve dynamically-generated images, on-the-fly generated PDF-files and similar content to the web browser.

refer this for more details
http://msdn.microsoft.com/en-us/library/system.web.ihttphandler%28lightweight%29.aspx
  kalpana aparnathi replied to rajesh kumar
14-Dec-11 01:33 PM

An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler. You can create your own HTTP handlers that render custom output to the browser.

An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life-cycle events throughout the request. HTTP modules let you examine incoming and outgoing requests and take action based on the request.

Typical uses for custom HTTP handlers include the following:

  • RSS feeds   To create an RSS feed for a Web site, you can create a handler that emits RSS-formatted XML. You can then bind a file name extension such as .rss to the custom handler. When users send a request to your site that ends in .rss, ASP.NET calls your handler to process the request.

  • Image server   If you want a Web application to serve images in a variety of sizes, you can write a custom handler to resize images and then send them to the user as the handler's response.

Typical uses for HTTP modules include the following:

  • Security   Because you can examine incoming requests, an HTTP module can perform custom authentication or other security checks before the requested page, XML Web service, or handler is called. In Internet Information Services (IIS) 7.0 running in Integrated mode, you can extend forms authentication to all content types in an application.

  • Statistics and logging   Because HTTP modules are called on every request, you can gather request statistics and log information in a centralized module, instead of in individual pages.

  • Custom headers or footers   Because you can modify the outgoing response, you can insert content such as custom header information into every page or XML Web service response.

Create New Account
help
alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What are the 2 important parts of a master page? The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages Can Master Pages be nested? Yes, Master Pages
using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are of using Query Strings? (I) What is Absolute and Sliding expiration? (I) What is cross page posting? 93 (I) How do we access viewstate value of this page in the next page ? (I) Can we post and access view state in another application? (I) What is SQL In which event are the controls fully loaded? (B) How can we identify that the Page is Post Back? (B) How does ASP.NET maintain state in between subsequent request? (A) What is event bubbling? B) How do we assign page specific attributes? (A) How do we ensure viewstate is not tampered? (B) What is the control are valid and proper? (A) If client side validation is enabled in your Web page, does that mean server side code is not run. (A)Which JavaScript file is referenced
deploy the application on iis i want one small sample application of asp.net showing it how to deploy it on the iis For deployment, first we need to understand IIS, it's request processing and then we'll go for deployment of the website and various configuration available in IIS, their key features, advantages and disadvantages etc. . • IISIIS and URL Processing • IIS6.0 Process Model • Managing a Virtual directory • Making a Virtual Directory your ASP.NET applications available to everyone. • Microsoft Web Deployment Tool Technical Preview 1 : The IIS team recently posted the first preview of a new Microsoft Web Deployment tool. This tool one to check out. To learn more, read the walkthroughs at the bottom of this page (in particular the "Introduction to MS Deploy" one). This tool is awesome and should make
configure IIS (XP) for access my project from another pc Hi. . i want to access my project windows XP. can i publish my project with windows xp environment. . and what version of IIS should i use. . . pls help me. . . Hi try this • Click Start , click Control Panel , and Components . • When the Windows Components Wizard appears, click Next . • In the Windows Components list, select IIS . • Click Next, and follow the instructions. inetmgr How to Configure IIS to Host my Web Page inetmgr Install in Windows 7: • Click the Start button (or the Windows button), and then and Internet Information Services Hostable Web Core , click OK, and wait for it to install. IIS allows you to host a web page on your own computer that can be accessed by others using the DNS name or The IP address can be found by using the command ipconfig in command prompt. The IIS is configured using the IIS snap-in, previously called the Internet Services Manager. This can