Archive for May, 2009

An Overview of HTTP Handlers

An HTTP handler is a process that runs on server to response to a particular type of request. HTTP handlers can be referred to as endpoint also. A typical example of HTTP handlers is when ASP.net page handler which is used by asp.net engine to process the request that come for .aspx files.

Built In HTTP Handlers in ASP.net

Handler Description
ASP.net Page Handler (*.aspx) A default page handler for all ASP.net pages.
Web Service handler(*.mspx) The default HTTP handler for Web service pages created as .asmx files in ASP.NET.

Generic Web handler (*.ashx)

The default HTTP handler for all Web handlers that do not have a UI and that include the @ WebHandler directive.

Trace handler (trace.axd)

A handler that displays current page trace information. For details, see How to: View ASP.NET Trace Information with the Trace Viewer.

 

How to Create A Custom HTTP Handler

To create a custom HTTP Handler you need to implement either IHttpHandler or IHttpAsyncHandler for synchronous and asynchronous handlers. Both these interfaces expose two methods called IsReusable and ProcessRequest. ProcessRequest method is the place where you write code for handling request of your custom handler. The IsReusable property specifies whether the IHttpHandlerFactory object (the object that actually calls the appropriate handler) can put the handler in a pool and reuse it to increase performance. If the handler cannot be pooled, the factory must create a new instance of the handler every time that the handler is needed.

Public Class CustomHand
    Implements IHttpHandler


    Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
        Get

        End Get
    End Property

    Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest

    End Sub
End Class

Mapping File Extension in IIS

By Default IIS is going to respond to file extension that is for custom handler. If you created a new file extension for HTTP Handler then you have to explicitly register the file extension in IIS and have to add a mapping entry in web.config file for your custom handler.

PHPAzure: PHP SDK for Azure

At the TechEd India Microsoft has announced PHP SDK for Azure. PHPAzure is an open source software development kit that allows PHP developers to build PHP applications for Azure platform. This SDK also Provides consistent programming model for Windows Azure Storage (Blobs, Tables & Queues).

PHPAzure Features:

  • PHP classes for Windows Azure Blobs, Tables & Queues (for CRUD operations)
  • Helper Classes for HTTP transport, AuthN/AuthZ, REST & Error Management
  • Manageability, Instrumentation & Logging support.
  • PHP SDK for Windows Azure is an open source collaboration project driven by RealDolmen and Microsoft.

    PHPAzure Architecture

    PHPAzure architecture

     

    Download PHPAzure SDK