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