Reputation: 14095
I got this error when I browsed web/_layouts/handler/ahandler.ashx
An error occurred during the processing of /_layouts/handler/ahandler.ashx. Could not create type 'BabyClubDemo.Layouts.Handler.AHandler'.
Here is my ashx page
<%@ WebHandler Language="C#" CodeBehind="AHandler.ashx.cs" Class="BabyClubDemo.Layouts.Handler.AHandler" %>
Here is my ashx.cs
using System;
using System.Web;
namespace BabyClubDemo.Layouts.Handler
{
public class AHandler : IHttpHandler
{
/// <summary>
/// You will need to configure this handler in the web.config file of your
/// web and register it with IIS before being able to use it. For more information
/// see the following link: http://go.microsoft.com/?linkid=8101007
/// </summary>
#region IHttpHandler Members
public bool IsReusable
{
// Return false in case your Managed Handler cannot be reused for another request.
// Usually this would be false in case you have some state information preserved per request.
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Write(CallServerFunction(context));
}
private string CallServerFunction(HttpContext context)
{
return "testing the applicaiton";
}
#endregion
}
}
What could be the possible issue ? my .net framework is 3.5.
Upvotes: 1
Views: 2472
Reputation: 36
ASHX files are not processed to replace the tokens by default, you can change this behaviour.
Steps to change this behaviour:
2.
<PropertyGroup>
<TokenReplacementFileExtensions>ashx</TokenReplacementFileExtensions>
</PropertyGroup>
Upvotes: 0
Reputation: 21798
I'm pretty sure you will need to use the fully qualified name of the assembly instead of only using Class=BabyClubDemo.Layouts.Handler.AHandler
.
A very similar response was posted on SharePoint Stackexchange: https://sharepoint.stackexchange.com/questions/19928/sharepoint-2010-and-ashx-handler
Upvotes: 1