HttpBaseProtocolFilter (WP to Android) (C#)

HanSwinkelsHanSwinkels USMember

Hello,

I'm converting an app from Windows Phone to android.

`public async Task Authenticate(string username, string password)
{
using (var filter = new HttpBaseProtocolFilter())
using (var client = new HttpClient(filter))
{
var parameters = new Dictionary<string, string>
{
{"wu_loginname", username},
{"wu_password", password},
};

            var uri = new Uri("[url]");

            using (var response = await client.PostAsync(uri, new HttpFormUrlEncodedContent(parameters)))
            {
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    this.CookieCollection = filter.CookieManager.GetCookies(uri);
                    return true;
                }

                this.CookieCollection = null;
                return false;
            }
        }
    }`

This is the code I need to convert but visual studio gives me an error at new HttpBaseProtocolFilter() .
How do I need to change it so it will work.

I already installed a library to make HttpClient work

Thanks in advance,

Han Swinkels

Answers

Sign In or Register to comment.