How to post XML data via HTTP POST method in windows store apps? -
any samples on consuming rest service post method in windows 8 apps.please let me know possible links on that.
try this
using system.io; using system.net.http; using system.text; var objhttpclient = new httpclient(); var formparameters = "<details><id>1</id><name>test</name></details>"); var objhttprequestmessage = new httprequestmessage(httpmethod.post, "http://example.com/page"); objhttprequestmessage.content = new streamcontent(new memorystream(encoding.utf8.getbytes(formparameters))); objhttprequestmessage.content.headers.add("content-type", "text/xml"); var result = await objhttpclient.sendasync(objhttprequestmessage);
also check httpclient sample on msdn
Comments
Post a Comment