Obsolete documentation for C# Rest API

Hi

The sample code that provided for C# in “https://rt-wiki.bestpractical.com/wiki/REST” is Obsolete and no longer is supported with newer versions of .NET

Can anyone help me how I can use Cookie base authentication? I get Credentials Required error message

        var credentials = new NetworkCredential(name, pass);
        CookieContainer CookieContainer = new CookieContainer();
        var handler = new HttpClientHandler { CookieContainer = CookieContainer, Credentials = credentials };
        using (var client = new HttpClient(handler))
        {

            client.BaseAddress = new Uri("https://something.net");

            var form = new List<KeyValuePair<string, string>>();
            form.Add(new KeyValuePair<string, string>("user", name));
            form.Add(new KeyValuePair<string, string>("pass", pass));

            var request = new HttpRequestMessage(HttpMethod.Post, "/rt/REST/1.0");

            request.Content = new FormUrlEncodedContent(form);

            var response = await client.SendAsync(request);

            var contents = await response.Content.ReadAsStringAsync();

        }