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

HttpHandlerUrl property with parameter?

4 Answers 138 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
alien9882
Top achievements
Rank 1
alien9882 asked on 15 Feb 2011, 05:09 PM
Hi,

When I set HttpHandlerUrl like "~/Handler.ashx?ID=1&Name=b", I got the following error:
~/Handler.ashx?ID=1&Name=b is not a valid virtual path.

It would make life much easier if I can directly pass value through query string rather than implementing configuration object and so on,

Is it possible??

Thanks,
Charlie




4 Answers, 1 is accepted

Sort by
0
alien9882
Top achievements
Rank 1
answered on 16 Feb 2011, 11:44 AM
No one answered this??

All right I gave up and went back the way to implement AsyncUploadConfiguration object, but still couldn't get it working. The value of additional fields didn't pass to the handler??

Any ideas????

On the Default.aspx.cs
MyNamespace.FileConfig oConfig = AsyncUpload1.CreateDefaultUploadConfiguration<MyNamespace.FileConfig>();
oConfig.Name= "Charlie";
oConfig.Account= "blalbalba";
AsyncUpload1.UploadConfiguration = oConfig;
AsyncUpload1.HttpHandlerUrl = "~/Test/Handler.ashx";


namespace MyNamespace
{
    public class FileConfig : AsyncUploadConfiguration
    {
        private string sName = string.Empty;
        public string Name
        {
            get { return sName ; }
            set { sName = value; }
        }
 
        private string sAccount= string.Empty;
        public string Account
        {
            get { return sAccount; }
            set { sAccount= value; }
        }
 
    }
}

namespace MyNamespace
{
    public class FileConfigResult : AsyncUploadResult
    {
        private string sFileID;
 
        public string FileID
        {
            get { return sFileID; }
            set { sFileID = value; }
        }
    }
}


public class Handler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
{
    protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
    {
        // Call the base Process method to save the file to the temporary folder
        // base.Process(file, context, configuration, tempFileName);
 
        // Populate the default (base) result into an object of type SampleAsyncUploadResult
        AsyncUploadResult result = CreateDefaultUploadResult<MyNamespace.FileConfigResult>(file);
        
       //Name and Account are empty in the object!!
        MyNamespace.FileConfig oConfig = configuration as MyNamespace.FileConfig;
 
          return result;
      }
}

0
Genady Sergeev
Telerik team
answered on 18 Feb 2011, 11:51 AM
Hi alien9882,

We are currently implementing passing custom parameters in the query string. I believe we will be able to present a solution for the upcoming Q1 release.

As for the configuration object not passing values to the handler, please, update to the latest possible version and try again. There used to be an issue with the custom configuration but we have resolved it. Does the issue persist after the upgrade?

Kind regards,
Genady Sergeev
the Telerik team
0
alien9882
Top achievements
Rank 1
answered on 20 Feb 2011, 02:21 PM
Hi,

Thanks for your reply. We purchased the product on Jan 2011 so I suppose it's the latest one?
Any schedule for Q1 release?

Thanks,
Charlie
0
alien9882
Top achievements
Rank 1
answered on 21 Feb 2011, 10:49 PM
Hi again,
After installing latest one the problem is solved.

Thanks,
Charlie 
Tags
AsyncUpload
Asked by
alien9882
Top achievements
Rank 1
Answers by
alien9882
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or