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:
This is my Custom Handler:
I have registered the handler in web.config:
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
>