0
我使用這行如何傳遞字符串作爲參數?使用System.Net.Http;
client.PostAsync("mysite.net/login.asmx/login", content);
我需要我的內容是這樣的ID = 21 &名= MYNAME &密碼=傳遞& JSON = 1 這應該是一個字符串 但接受鍵入這裏是一個FormUrlEncodedContent因此,我不知道這個類如何創建值,如果它的工作原理像一個JSON或如果它會改變這種結構ID = 21 & name = myname & password = pass & json = 1,我需要(它應該是其餘的url) 我怎樣才能發送它,並收到將它轉換爲我的班級的響應用戶,例如?
我使用它,以及
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"),
});
怎麼我的web服務會接受呢?這個類(上面)如何組織鍵值?
我的課
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; }
}
非常感謝你。 我真的需要這個幫助
'收到將其轉換爲我的班級用戶的響應請包括**用戶**的源代碼。 – mjwills
我會,等.... –
@mjwills我該怎麼辦?你能幫忙嗎? –