I am developing an ASP .Net website.
I have created a custom HTTP handler to respond to requests aiming resources with .videoImage extension.
Here are the first lines of the file corresponding to my handler :
<%@ WebHandler Language="C#" Class="CompleteSubtitles.VideoImage" %>
using System;
using System.Web;
using System.IO;
using SubtitleSounds.DataManagement;
namespace CompleteSubtitles
{
public class VideoImage : IHttpHandler
{
...
}
}
The handler file is located in a subfolder of the website root folder.
I have configured my handler in my website root web.config file as follows :
<configuration>
<system.web>
...
<httpHandlers>
<add verb="*" path="*.videoImage" type="CompleteSubtitles.VideoImage" />
</httpHandlers>
</system.web>
</configuration>
I have got an ASP .Net error message when loading a page informing me that the loading of CompleteSubtitles.VideoImage type failed.
Does anyone know why ?
Any help will be greatly appreciated.
you have to specify the full name of the class (HttpHanlder) as follows:
For more click here
Hope it will help.
Whitout the exact error message I can't be sure, but when from my experience with handlers and Web Forms, this works:
Your Handler can't be a simple VB/CS file, even if you place it on APP_CODE folder (never worked with me). You need place in a DLL, I always use a separate Class Library for that.
If the host uses IIS 7, system.web/httpHandlers don't work, you need to add system.webServer. I keep both just in case. Here is a sample (bNet.Ferramentas is my DLL file):
>
Here is how I have solved my problem :
I have created a class representing my handler in my App_Code folder.
My handler file's extension is ".cs" and not ".ashx".
The declaration of my handler in my web.config is :