locked
BackgroundUploader and header RRS feed

  • Question

  • I'm using the BackgroundUploader to upload to a cloud service that uses OAuth

    If I set an header with :

    uploader.SetRequestHeader("Authorization""OAuth "+ header); 

    and just do:

    UploadOperation upload = uploader.CreateUpload(uri, file);
    

    I can see in fiddler that the header is not sent!


    But if I use the :

    List<BackgroundTransferContentPart> parts = new List<BackgroundTransferContentPart>();
                var part = new BackgroundTransferContentPart();
                part.SetFile(file);
                parts.Add(part);

    and then

    UploadOperation upload = await uploader.CreateUploadAsync(uri, parts);
    

    It sends the header.

    The problem is my Cloud Service needs the file to be sent on the body and with the BackgroundTransferPart the body has more than the files (bondaries etc etc)

    Any thoughts on how to fix my first scenário?


    cmorgado

    Thursday, January 30, 2014 10:34 AM

Answers

  • Looking at the sample listed in the BackgroundUploader class, it shows the exact method you're using:

    BackgroundUploader uploader = new BackgroundUploader();
    uploader.SetRequestHeader("Filename", file.Name);
    UploadOperation upload = uploader.CreateUpload(uri, file);

    If it's definitely not sending the header, then this sounds like a bug we need to investigate. It sounds like you may need to find an alternative method of sending the file.  If you have an app we can investigate, please post a link to it.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, January 30, 2014 8:21 PM
    Moderator