Friday, August 12, 2005

Misnomer about HttpHandler

When an aspx page is created it is automatically creating an end point reference or a handler. To act as a handler within the pipeline a class must implement the IHttpHandler. Therefore custom handlers can be created using this interface.
You can create a file with ashx extension. The benefit of using this extension is then you don’t need to register the new extension as well as no specific configuration entries.
Either way the issue comes when an installer package is created. The ashx file or any other extension chosen to be the handler is not seen. This is not needed in the deployment if you have compiled it into an assembly. Many developers try to forcefully include the ashx file into the virtual directory assuming it’s needed. Technically it is compiled into the assembly and hence not needed. The questions are -: What if I am giving the location such as http://myServer/myVirtualDir/myHandler.ashx specifically as an endpoint reference? If the ashx file is not part of the deployment package, how can the location be provided?
These are typical questions and my answer is you don’t need the file ashx to be physically present in the virtual directory if you have the compiled assembly. You can still reference it and when request goes to the IIS it knows to get to it.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home