This is a migrated thread and some comments may be shown as answers.

Custom Http Handler not being called

2 Answers 367 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Gary asked on 09 Jan 2014, 09:39 PM
I have created a custom http handler but I don't see that it is being called. When I put a breakpoint in the code for the custom handler, it never gets hit. I also see that when I cast the UploadResult object to my custom result object in the server side FileUploaded event after a postback, I get null.

It was working locally in VS2010 before I registered the handler in web.config. But I had to register the handler to deploy it to my IIS server.

What am I doing wrong?

Here is a snippet of what I'm doing.

Here is my upload control:
        OnClientFileUploaded ="upFiles_onClientUploadFinished"
        ><FileFilters><telerik:FileFilter Extensions="jpeg,jpg,gif,tif,png,bmp,pdf" /></FileFilters>

This is my Custom Handler:
public class UploadHandler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
    protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
        // Populate the default (base) result into an object of type SampleAsyncUploadResult
        CustomAsyncUploadResult result = CreateDefaultUploadResult<CustomAsyncUploadResult>(file);
        //do some processing here...
        base.Process(file, context, configuration, tempFileName);
        return result;

I have registered the handler in web.config:
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
      <add path="UserControls/CustomHandlers/UploadHandler.ashx" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
      <add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <remove name="ChartImage_axd" />
      <remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
      <remove name="Telerik_Web_UI_DialogHandler_aspx" />
      <remove name="Telerik_RadUploadProgressHandler_ashx" />
      <remove name="Telerik_Web_UI_WebResource_axd" />
      <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
      <add name="UserControls/CustomHandlers/UploadHandler_ashx" verb="*" preCondition="integratedMode" path="UserControls/CustomHandlers/UploadHandler.ashx" type="Telerik.Web.UI.WebResource" />
    <validation validateIntegratedModeConfiguration="false" />

2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 13 Jan 2014, 04:14 PM
Does anyone have info on this??
Hristo Valyavicharski
Telerik team
answered on 14 Jan 2014, 12:51 PM
Hi Gary,

Check if there are any JavaScript errors on the page. Also have in mind that AsyncUpload with such configuration will reject all files that are larger than 4 MB. This means that the file will not be passed to the Process() method of the handler. To resolve it, please try to remove the the DisableChunkUpload property.

Hristo Valyavicharski
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question