can't read querystring value in SaveChunkData method

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    17 posts
    Member since:
    May 2009

    Posted 25 Apr 2011 Link to this post

    I rearrange my code to make it work with the SaveChunkData method. Unfortunately I can't read the querystring value in the SaveChunkData method. I have tried the following, the threadID is always null even tough I see a value in the querystring:

    //http://localhost/myapp/User/MultiPhotoUpload.aspx?threadID=20&threadTypeID=3
                    //HttpContext.Current.Handler.ProcessRequest(HttpContext.Current);
                    HttpContext.Current.CurrentHandler.ProcessRequest(HttpContext.Current);

                    HttpRequest request = Context.Request;

                    string testRequest = request.QueryString["threadID"];

                    string thisFormThreadID = this.Request.Form["threadID"];

                    string thisThreadID = this.Request.QueryString["threadID"];

                  //HttpContext context = new base.Request.QueryString["threadID"];

                    string testThreadID = HttpContext.Current.Request.QueryString["threadID"];

                    string formThreadID = HttpContext.Current.Request.Form["threadID"];

                    //HttpContext.Current.Handler.ProcessRequest(HttpContext.Current);

                    string baseThreadID = base.Request.QueryString["threadID"];

                    string contextThreadID = base.Context.Request.QueryString["threadID"];

                    string threadID = Context.Request.QueryString["threadID"];

    Here is my SaveChunkData method, why is my threadID value always null. I must not understand something, please enlighten me, thanks.

     

     

    public

     

     

    override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)

     

     

    {

     

     

     

    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);

     

     

     

     

    try

     

     

     

     

     

     

     

    {

     

     

     

    if (this.IsFinalFileRequest())

     

     

    {

     

     

     

    //If the file is successfully uploaded.

     

     

     

     

     

     

     

     

     

    if (result)

     

     

    {

     

     

     

    string threadID = this.Request.Form["threadID"];

     

     

     

     

    if (!String.IsNullOrEmpty(this.Request.Form["threadID"]))

     

     

    {

     

     

     

    if (!SYLWebUtility.ImageHelper.VerifyDirectoryExistsForNewFile(this.GetFilePath()))

     

     

    {

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameMessage, UserInterfaceMessages.UserInterfaceMessage.ErrorMessage(UserInterfaceMessages.Enumerations.UIErrorMessage.ProblemsAddingData, SYLWebUtility.LanguageHelper.GetLanguageIDByTwoLetterISOLanguageName()));

     

     

     

     

    this.ReturnMandatoryParameters(result, this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    this.SaveFiles();

     

     

    }

     

     

     

    else

     

     

     

     

     

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    }

     

    }

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    catch (Exception)

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    }

     

     

     

     

     

    public

     

     

    override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)

     

     

    {

     

     

     

     

    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);

     

     

     

     

     

    try

     

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (this.IsFinalFileRequest())

     

     

    {

     

     

     

     

    //If the file is successfully uploaded.

     

     

     

     

     

     

     

     

     

     

     

     

    if (result)

     

     

    {

     

     

     

     

    string threadID = this.Request.Form["threadID"];

     

     

     

     

     

    if (!String.IsNullOrEmpty(this.Request.Form["threadID"]))

     

     

    {

     

     

     

     

    if (!SYLWebUtility.ImageHelper.VerifyDirectoryExistsForNewFile(this.GetFilePath()))

     

     

    {

     

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameMessage, UserInterfaceMessages.UserInterfaceMessage.ErrorMessage(UserInterfaceMessages.Enumerations.UIErrorMessage.ProblemsAddingData, SYLWebUtility.LanguageHelper.GetLanguageIDByTwoLetterISOLanguageName()));

     

     

     

     

     

    this.ReturnMandatoryParameters(result, this.IsFinalFileRequest());

     

     

     

     

     

    return result;

     

     

    }

     

     

     

     

    this.SaveFiles();

     

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

     

     

    System.IO.

     

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    }

     

    }

     

    }

     

    ReturnMandatoryParameters(result,

     

     

    this.IsFinalFileRequest());

     

     

     

     

     

    return result;

     

     

    }

     

     

     

     

    catch (Exception)

     

     

    {

     

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

     

     

    System.IO.

     

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    ReturnMandatoryParameters(result,

     

     

    this.IsFinalFileRequest());

     

     

     

     

     

    return result;

     

     

    }

     

     

     

    }

     

    public

     

     

    override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)

     

     

    {

     

     

     

    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);

     

     

     

     

    try

     

     

     

     

     

     

     

    {

     

     

     

    if (this.IsFinalFileRequest())

     

     

    {

     

     

     

    //If the file is successfully uploaded.

     

     

     

     

     

     

     

     

     

    if (result)

     

     

    {

     

     

     

    string threadID = this.Request.Form["threadID"];

     

     

     

     

    if (!String.IsNullOrEmpty(this.Request.Form["threadID"]))

     

     

    {

     

     

     

    if (!SYLWebUtility.ImageHelper.VerifyDirectoryExistsForNewFile(this.GetFilePath()))

     

     

    {

     

     

     

    this.AddReturnParam(RadUploadConstants.ParamNameMessage, UserInterfaceMessages.UserInterfaceMessage.ErrorMessage(UserInterfaceMessages.Enumerations.UIErrorMessage.ProblemsAddingData, SYLWebUtility.LanguageHelper.GetLanguageIDByTwoLetterISOLanguageName()));

     

     

     

     

    this.ReturnMandatoryParameters(result, this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    this.SaveFiles();

     

     

    }

     

     

     

    else

     

     

     

     

     

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    }

     

    }

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    catch (Exception)

     

     

    {

     

     

     

    if (SYLWebUtility.ImageHelper.VerifyFileExists(this.GetFilePath()))

     

     

    {

     

     

     

    //Deletes the specified file. An exception is not thrown if the specified file does not exist.

     

     

     

     

     

     

     

    System.IO.

     

    File.Delete(this.GetFilePath());

     

     

    }

     

    ReturnMandatoryParameters(result,

     

    this.IsFinalFileRequest());

     

     

     

     

    return result;

     

     

    }

     

     

     

    }

     

     

     

                    //string threadID = HttpContext.Current.Request.QueryString["threadID"];

                    //string tID = this.Request.Form["threadID"];

                    //string thID = this.Request.QueryString["threadID"];

                    //string threadID = Request.QueryString["threadTypeID"];



  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 28 Apr 2011 Link to this post

    Hi Patrick,

    The RadUpload will send requests to the RadUploadHandler's url and it is not the same request as the one of the page. If you want to pass query string parameters to the RadUploadHandler, I would recommend passing them as upload handler service parameters from the silverlight control

    Kind regards,
    Alex Fidanov
    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
  3. DevCraft banner
Back to Top