C#Wcf后值
我想接收通过html表单发送的POST请求C#Wcf后值,c#,wcf,C#,Wcf,我想接收通过html表单发送的POST请求 [OperationContract(Name = "post_test")] [WebInvoke( Method = "POST", UriTemplate = "post", ResponseFormat = WebMessageFormat.Json)] Result postMth(Stream stream); public Result postMth(S
[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"]);
}
我怎样才能收到通过我的表格发送的邮件
数据结果:
------WebKitFormBoundary24UETQYkoz77p3Tt
Content-Disposition: form-data; name="mypost"
some text
在您的
postMth
中尝试使用此代码:
MultipartParser parser = new MultipartParser(stream);
if (parser.Success)
{
// Put your code here
}
MultipartParserlibrary是一个简单的类,它解析包含二进制数据的多部分表单数据并返回文件流
我不想保存内容。我只是想得到我的职位