INFO: Migrating from .NET HttpWebRequest to Rebex HttpRequest
In many cases, upgrading from .NET's
System.Net.HttpWebRequest to Rebex
straightforward. However, please be aware that for various reasons,
it is not a one-to-one replacement. This article discusses common pitfalls.
HttpRequest does not inherit from HttpWebRequest
System.Net.HttpWebRequest and Rebex
HttpRequest inherit from
In an ideal world, we would inherit
HttpWebRequest to ensure a smooth migration.
Unfortunately, this is not possible because
HttpWebRequest was not designed to allow inheritance and lacks a suitable constructor.
This could pose a problem when using Rebex HTTPS within an application or with a library that has been designed to only use
and assume that
WebRequest.Create will always return an instance of this object.
The recommended workaround is to modify existing application or library code
HttpRequest instead of
HttpRequest does not use ServicePointManager
HttpRequest does not utilize
To implement a custom server certificate validation routine, use
custom certificate validation event.
HttpRequest uses a different proxy API
HttpRequest does not support the
Proxy property and does not utilize system's default proxy.
If you intend to connect via a proxy, use
HttpRequest does not establish connection automatically by default
On .NET Compact Framework, .NET's
HttpWebRequest class attempts to establish an Internet connection when a network is not accessible.
HttpRequest does not do this by default. To enable equivalent behavior, set