This is a known issue with libraries which assume that
System.Net.WebRequest.Create(Uri) always returns an instance of
var request = (HttpWebRequest)WebRequest.Create(uri);
However, after registering Rebex
WebRequest.Create returns instances of
Rebex.Net.HttpRequest which inherit from
System.Net.WebRequest (not from
System.Net.HttpWebRequest), which means the code above would fail.
Unfortunately, there is not much we can do about this.
HttpRequest does not inherit from
HttpWebRequest because it did not have a suitable constructor until .NET 4.5, and even that is not intended to actually be used by third-party code and produces an error on compilation. Using the protected serialization constructor doesn't seem quite right either because it has been made obsolete in .NET 2.0 already.
So the only reasonable solution at the moment is to modify third-party libraries to accept instances of
System.Net.WebRequest as well (or modify them to use Rebex
HttpRequest instead of .NET's
HttpWebRequest). Unfortunately, in case of closed-source third-party libraries, that persuading the vendor to make the library compatible with
System.Net.WebRequest might be a challenge.