【发布时间】:2017-08-05 09:24:55
【问题描述】:
我正在使用这条线
client.PostAsync("mysite.net/login.asmx/login", content);
我需要我的内容类似于 id=21&name=myname&password=pass&json=1 它应该是一个字符串 但这里接受的类型是 FormUrlEncodedContent ,因此我不知道这个类是如何创建值的,它是否像 json 一样工作以及它是否会改变这个结构 id =21&name=myname&password=pass&json=1 我需要的(应该是网址的其余部分) 例如,如何发送和接收将其转换为我的类用户的响应?
我也在用它
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("id", "125"),
new KeyValuePair<string, string>("mailadress", login),
new KeyValuePair<string, string>("password", pass),
new KeyValuePair<string, string>("json", "1"),
});
我的网络服务将如何接收它?这个类(上)如何组织键值?
我的班级
class User
{
public string codigo { get; set; }
public string nome { get; set; }
public string email { get; set; }
public string senha { get; set; }
public string imagem { get; set; }
public DateTime dataDeNasc { get; set;}
public string cidade { get; set; }
public string estado { get; set; }
public string telefone { get; set; }
public string sexo { get; set; }
}
非常感谢。 我真的需要这个帮助
【问题讨论】:
-
receive the response converting it to my class user请附上用户的源代码。 -
我会的,等等……
-
@mjwills 我该怎么办??你能帮忙吗?
标签: c# visual-studio post system.net.httpwebrequest