Bug Report T295187
Visible to All Users

UploadControl - Uploading an empty file into Azure results in the "BadRequest RequestResult: InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format." error

created 9 years ago (modified 9 years ago)

When uploading an empty file with the upload control set to Azure mode an error occurs. I can also no find an easy way  to change this error message, validate the file size before hand (using upload control in advanced mode, so the file inputs FileList is empty for some reason once you upload a file) or ideally to just allow the upload of an empty file.

The full error message you get is in the format -  "Bad request. StatusCode: BadRequest RequestResult: InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format. RequestId:d071a4d8-0001-0007-085c-fb4156000000 Time:2015-09-30T08:49:25.0490557ZContent-Length0"

It could also be helpful to provide a client side event for when an error like this occurs so you can perform some action depending on the error, is this available?

I assume this is a bug? You can recreate this by creating an empty file (" fsutil file createnew filename 0" in the command line) and try to upload this to azure using an Upload control set to use Azure mode.

Comments (3)
DevExpress Support Team 9 years ago

    Hello,

    I was able to reproduce this issue and passed this ticket to our developers for further research.
    We will update this ticket as soon as we get results.

    Regarding your question about error handling - there are no such error handlers on the client side but you can handle these errors in Global.asax, for example, the following code will display the "Cloud upload failed." string:

    C#
    protected void Application_Start() { ... DevExpress.Web.ASPxWebControl.CallbackError += Application_Error; }  protected void Application_Error(object sender, EventArgs e) { var exception = HttpContext.Current.Server.GetLastError(); if (exception.Message.Contains("Bad request")) DevExpress.Web.ASPxWebControl.SetCallbackErrorMessage("Cloud upload failed."); }

    Please refer to the Handling Callback Exceptions on Server | ASP.NET Controls and MVC Extensions | DevExpress Help documentation article to learn how to handle errors in the Global.asax file.

      Hi,
      I tried your solution to update the error message but the Application_Error would not get hit on a CallbackError.
      When I try to upload an empty file with a breakpoint in the Application_Error method, the breakpoint will not get hit and the message will stay as it originally was.
      I would upload a demo project but it won't let me upload a file more than 30MB

      DevExpress Support Team 9 years ago

        Hello,

        To process your recent post more efficiently, I created a separate ticket on your behalf: T296086: CallbackError event handler is not invoked on callback error. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

        Answers approved by DevExpress Support

        created 9 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.