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

Custom Http Handler not being called

2 Answers 232 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 09 Jan 2014, 09:39 PM
Hi,
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:
<telerik:RadAsyncUpload
        Width="225px"
        TargetFolder="~/Temp/TempUploadFiles"
        ID="upFiles"
        runat="Server"
        InputSize="20"
        AllowedFileExtensions="jpeg,jpg,gif,tif,png,bmp,pdf"
        OnFileUploaded="RadAsyncUpload1_FileUploaded"
        OnClientFileUploading="upFiles_onClientFileUploading"
        OnClientFileUploaded ="upFiles_onClientUploadFinished"
        OnClientFileUploadFailed="upFiles_onClientUploadFailed"
        OnClientFileDropped="upFiles_onClientUploadDropped"
        OnClientFileUploadRemoved="upFiles_onClientUploadRemoved"
        OnClientValidationFailed="OnClientValidationFailed"
        HttpHandlerUrl="~/UserControls/CustomHandlers/UploadHandler.ashx"
        MaxFileInputsCount="1"
        TemporaryFileExpiration="5"
        DisableChunkUpload="true"
        ><FileFilters><telerik:FileFilter Extensions="jpeg,jpg,gif,tif,png,bmp,pdf" /></FileFilters>
 </telerik:RadAsyncUpload>

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:
<Configuration>
       ...
      <httpHandlers>
      <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" />
    </httpHandlers>
    <httpModules>
      <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=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
   ...
   <system.webServer>
      <handlers>
      <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" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>
   ...
</Configuration>

2 Answers, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 13 Jan 2014, 04:14 PM
Does anyone have info on this??
0
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.

Regards,
Hristo Valyavicharski
Telerik
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.
Tags
AsyncUpload
Asked by
Gary
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or