Multipart POST without an authorization HTTP header

91 views
Skip to first unread message

brad dunbar

unread,
Feb 26, 2010, 3:36:06 PM2/26/10
to DotNetOpenAuth
When attempting to post a file using the following code:

var req = Consumer.PrepareAuthorizedRequest(new
MessageReceivingEndpoint("[url]", HttpDeliveryMethods.PostRequest),
Vimeo.Token, new[]
{
MultipartPostPart.CreateFormFilePart(FILEDATA, "<stream>",
contenttype, filedata)
});
req.Timeout = int.MaxValue;
var res = req.PostMultipart(new StandardWebRequestHandler(), new
List<MultipartPostPart>());
return res.GetResponseReader().ReadToEnd();

I get the following error:

Cannot send OAuth message as multipart POST without an
authorization HTTP header because sensitive data would not be signed.


Also, I have attempted to use
''HttpDeliveryMethods.AuthorizationHeaderRequest'' instead of the post
value, but I reveive the following error:

Cannot send OAuth message as multipart POST without an
authorization HTTP header because sensitive data would not be signed.

brad dunbar

unread,
Feb 26, 2010, 3:36:50 PM2/26/10
to DotNetOpenAuth
My question is this: What is causing these errors and how can I avoid
them?

Thanks
-brad dunbar

Andrew Arnott

unread,
Feb 26, 2010, 3:39:27 PM2/26/10
to dotnet...@googlegroups.com
Hi Brad,

Two things: 

first, use both flags: HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest
Second, you appear to be using multi-post twice.  If you pass the parts to the PrepareAuthorizedRequest method, just call HttpWebRequest.GetResponse() because the parts are already queued for sending.

--
Andrew Arnott
"I [may] not agree with what you have to say, but I'll defend to the death your right to say it." - S. G. Tallentyre
Reply all
Reply to author
Forward
0 new messages