HTTP Handlers and SharePoint 2010
May 1, 2012 Leave a comment
Trying to debug an error on a HTTP handler, we got the following error message:
Parser Error Message: Could not create type ‘MyNameSpace.MyClass’.
The HTTP handler directive on the ASHX file looked like this:
<%@ WebHandler Class="MyNameSpace.MyClass" %>
I found the solution for this issue at http://sharepoint.stackexchange.com/questions/19928/sharepoint-2010-and-ashx-handler.
Since we are using SharePoint 2010, the HTTP handler was deployed to the LAYOUTS folder. The trick here is that SharePoint needs to load all its referenced assemblies from the GAC and in this case the assembly was in the GAC but we were not referencing the FQDN of the assembly.
The ASHX file should look like this:
<%@ WebHandler Class="
MyNameSpace.MyClass, MyAssembly, Version=22.214.171.124, Culture=neutral, PublicKeyToken=7c8e2c3ef53023ee" %>
After updating the ASHX file the error was solved.