【发布时间】:2009-03-27 20:16:16
【问题描述】:
我正在尝试在 Silverlight 2.0 中使用 HttpWebRequest 对象来执行“POST”。
从 BeginGetStream 方法返回后,我会遇到以下错误:
消息:“不支持指定的方法。”
StackTrace:“在 System.Net.BHWRAsyncResult.get_AsyncWaitHandle()”
这里有一些示例代码:注意我使用 fiddler 来查看是否有任何东西通过网络发送并且没有网络活动。
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(new Uri("http://someurl"));
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Accept = "text/plain, */*";
req.Headers["X-Requested-With"] = "XMLHttpRequest";
AsyncCallback callBack = new AsyncCallback(streamResponse);
req.BeginGetRequestStream(callBack, null);
谢谢, 戴夫
【问题讨论】:
标签: silverlight httpwebrequest