Custom File Handler problem

2 posts, 0 answers
  1. Lighthouse Developer
    Lighthouse Developer avatar
    34 posts
    Member since:
    Feb 2010

    Posted 21 Jul 2010 Link to this post

    Hi,
    I have a question/problem about implementing my own  handler.
    I have follow the image uploader example in the demo but is seems that I cant get my handler to work.
    To be more specific,if I have not set the radupload to use my handler it works as expected.
    If I set it to use my handler (HttpHandlerUrl="~/CustomUploaderHandler.ashx") the uploading animation its always displayed and the file
    isnt uploaded.One more thing is that I have set a breakpoint inside the Process method of the Handler but its not hitted.
    Am I missing some configuration that is not mentioned in the demo?

    the HttpHandler code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Web.UI;
     
    namespace UploaderTest
    {
        public class CustomUploadHandler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
        {
     
            protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
            {
                base.Process(file, context, configuration, tempFileName);
    CustomAsyncUploadResult result = CreateDefaultUploadResult<CustomAsyncUploadResult>(file);
     
                return result;
            }
     
             
     
        }
    }
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2830 posts

    Posted 27 Jul 2010 Link to this post

    Hello,

    You should verify that your custom handler compiles correctly by accessing it directly:

    http://myapp/Path/Handler.ashx

    In your case the CustomAsyncUploadResult type is not defined. The example uses the following custom type to return the ImageID to the page:

    public class SampleAsyncUploadResult : AsyncUploadResult
    {
        private int imageID;
     
        public int ImageID
        {
            get { return imageID; }
            set { imageID = value; }
        }
    }

    I hope this helps.

    Kind regards,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top