Rebex.Net.Https and CredentialCache, Default Proxy

0 votes
asked Nov 30, 2018 by lanopk (1,600 points)

I'm sorry to ask you a very basic question.

(1) I can not use CredentialCache in Rebex HTTP request.

My CredentialCache can be assigned to a WebRequest.Credential in the default WebRequest,
but a CredentialCache can not be assigned to a Rebex HttpRequest.Credential.
An Arguments Exception is thrown.

var credCache = new CredentialCache();
credCache.Add(new Uri("http://.com/"),"Basic", new NetworkCredential(...,...));
credCache.Add(new Uri("http://.com/"),"Digest", new NetworkCredential(...,...));

var request = (Rebex.Net.HttpRequest) creator.Create(uri);

    request.Credentials = credCache;
    // Exception : Only NetworkCredential values are supported. Parameter name: value

(2) How do I set up the system default proxy when configuring Rebex's Http Proxy?

creator.Proxy = WebProxy.GetDefaultProxy(); // error

Thank you.

Applies to: Rebex HTTPS

1 Answer

+1 vote
answered Nov 30, 2018 by Lukas Pokorny (126,910 points)
selected Nov 30, 2018 by lanopk
Best answer


Rebex HttpRequest is not a one-to-one replacement for .NET HttpWebRequest, and you stumbled upon some of the differences. More are described in this KB article.

1) CredentialCache is not supported yet, but this is really an omission. We will add support for this to one of the next releases.

2) We chose not to support .NET's WebProxy for several reasons:

  • a) This .NET API doesn't make it possible to retrieve the actual proxy settings;
  • b) It doesn't make it possible to specify a SOCKS4/SOCKS5 proxy;
  • c) We don't support plain HTTP proxies, only HTTP CONNECT proxies suitable for HTTPS;
  • d) Demand for this is very low.

  • If you would like to reproduce a .NET-like behavior, determine proxy settings yourself (via Windows API or registry) and use Rebex Proxy API to pass these settings to Rebex HTTPS.