Rebex.Net.Https and CredentialCache, Default Proxy

0 votes
asked Nov 30 by lanopk (820 points)

Hi.
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);

try
{
    request.Credentials = credCache;
}
catch
{
    // 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.

1 Answer

+1 vote
answered Nov 30 by Lukas Pokorny (96,250 points)
selected Nov 30 by lanopk
 
Best answer

Hi,

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.

...