2
我想收到一个由HTML表单发送的POST请求。C#Wcf POST值
[OperationContract(Name = "post_test")]
[WebInvoke(
Method = "POST",
UriTemplate = "post",
ResponseFormat = WebMessageFormat.Json)]
Result postMth(Stream stream);
public Result postMth(Stream stream)
{
StreamReader reader = new StreamReader(stream);
string data = reader.ReadToEnd();
reader.Close();
NameValueCollection post = HttpUtility.ParseQueryString(data);
throw new Exception("Value = " + post["mypost"]);
}
我怎样才能收到我的POST var我的表单发送?
数据结果:
------WebKitFormBoundary24UETQYkoz77p3Tt
Content-Disposition: form-data; name="mypost"
some text
我不希望保存的内容。我只想得到我的POST – Sancho 2014-12-04 23:00:07
好吧,比放入一些其他代码。 – TheLittleHawk 2014-12-04 23:00:31