HttpWebRequest client proxy authenticate with selected proxy authentication type

kishore kumar 1 Reputation point
2022-01-13T10:59:14.787+00:00

Dear Team,

I am using HttpWebRequest class to make a GET request to URL & get the data via Proxy.
Proxy returns with 407 code & Proxy-Authenticate: Negotiate\r\n & Proxy-Authenticate: Basic realm="test"\r\n headers.

I want to HttpWebRequest client to use Basic type and authenticate.

I used to set the HttpWebRequest request header Authorization (request.Headers.Add("Authorization", "Basic " + XXXX)) to basic but it failed still 407 retuned.

Is there a way to select proxy authentication type from the client & authenticate the proxy?

If the proxy is supporting multiple authentication types (basic/NTLM/Digest/Negotiate) how HttpWebRequest client can choose proxy auth type?

Please share snippet code.

Thanks in advance
Kishore

Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. kishore kumar 1 Reputation point
    2022-01-17T14:33:22.783+00:00

    Is there any way to set AuthenticationSchemes for HttpWebRequest object.

    so that I can select proxy authentication type & provide credentials from client side it self.

    It seems HttpWebRequest class internally selecting AuthenticationSchemes based on the proxy server listed authentication schema like basic/NTLM/Digest/Negotiate.

    Please clarify me. If yes please share any reference link.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.