Creating a Custom HttpHandler in Windows SharePoint Services 3.0
Applies to: Windows SharePoint Services 3.0, Microsoft Office SharePoint Server 2007, Microsoft Visual Studio 2005
Ted Pattison, Critical Path Training
May 2007
$0 Should be:$0 $0$0 $0 $0 $0 context.Response.ContentType = "text/plain";$0 $0
- 7/11/2011
- Jovino Rodríguez
http://www.myrocode.com/post/2009/06/03/Custom-HttpHandler-in-SharePoint-2007-using-code-behind-and-debug-option.aspx
hope it helps.
- 1/4/2010
- M.L. Somers
- 12/12/2008
- WSS Editor
- 10/14/2008
- Aravind Lakshmanan
context.Response.ContentType = "text/plain"; // <----- missing semicolon
- 7/6/2008
- Gustavo [MVP MOSS]
- 7/8/2008
- Thomas Lee
[tfl - 8 july 08] the video is at http://wm.microsoft.com/ms/msdn/office/2007OfficeVisualHowTos/WSS3CreateCustomHttpHandler.wmv.
- 3/24/2008
- MauSOliveira
- 7/8/2008
- Thomas Lee
While I do like the ease of deployment of this type of http handler (and the fact that you do not have to deploy a web.config entry for the handler), in cases where you may not want to use the _layouts directory OR you want to have a custom file extension, here is an alternative method that works as well (although it does take one manual configuration step in IIS so it may not be suitable for a "No Touch Deployment")
1) Create your http handler as you normally would for an asp.net application. You can add references to the SharePoint DLLs and interact with the object model since you are in the App Pool.
2) Add and entry into your web.config to register your handler and define the extension you are going to use. IE:
<add verb="*" path="*.proxy" validate="false" type="Company.Web.UI.Handlers.MyFactoryHandler, Company.Web.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=X1f7a76176a5df0e" />
3) Define your custom extension in IIS through the IIS > Web SIte Properties > Home Directory > Configuration > Mappings
In this case, we defined a .proxy extension that the handler will pick up. Our handler is a .NET assembly so we need to add the mapping to route .proxy requests to the .net isapi dll (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll).. also, make sure you UNcheck the "<ake Sure File Exists" unless you want to get 404 errors when you are calling it.
- 9/13/2007
- SharePointing
