0

I am using this line

client.PostAsync("mysite.net/login.asmx/login", content);

And I need that my content be something like id=21&name=myname&password=pass&json=1 It should be a string but the accepted type here is a FormUrlEncodedContent and because of that I don't know how this class create the value, if it works like a json or not and if it will change this structure id=21&name=myname&password=pass&json=1 that I need (it should be the rest of the url) How can I send it and receive the response converting it to my class user, for example?

I am using it as well

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"),
                     });

How my webservice will receive it? how this class(above) organize the key-value?

my class

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; }
}

Thank you very much. I really need this help

3
  • 1
    receive the response converting it to my class user Please include the source code for user. Commented Aug 5, 2017 at 1:22
  • I will, wait.... Commented Aug 5, 2017 at 1:24
  • @mjwills How can I do?? could you help? Commented Aug 7, 2017 at 15:17

1 Answer 1

1

The sending of the body will be exactly like in the Form URL Encoded (similar to your example string), in your C# example it will be sent as:

id=125&mailaddress=login&password=pass&json=1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.