我正在尝试在 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);
谢谢,戴夫