Windows Phone 8中的getrequeststream

用户名

我想使用MSDN代码通过HttpWebRequest发布数据,但getresponse()无法正常工作。

System.net.httpwebrequest does not contain a definition for getrequeststream

http://msdn.microsoft.com/zh-CN/library/system.net.httpwebrequest.getresponse.aspx

 using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;

 HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://d.co/login.php");
 myReq.Method = "POST";
 myReq.ContentType = "application/json";
 Stream dataStream = (HttpWebResponse)myReq.GetRequestStream();
马克·格雷维尔(Marc Gravell)

Windows Phone上不存在该方法,因为您经常要使用异步IO。您需要GetRequestStreamAsyncBeginGetRequestStream*Async与相比Begin*方法通常更易于理解和使用,但需要使用最新的编译器。相关示例在电话中提供了一个基于文档的文档:http : //msdn.microsoft.com/zh-cn/library/windowsphone/develop/System.Net.HttpWebRequest(v=vs.105).aspx

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章