HttpRequest vs HttpRequestMessage vs HttpRequestBase

[Originally Posted By]: http://stackoverflow.com/questions/15718468/httprequest-vs-httprequestmessage-vs-httprequestbase

HttpRequest is present on the Page and UserControl classes as a GET-only property. Similarly, most of its own properties are also GET-only (see 1). This class is used by ASP.NET pages to get information about the incoming http request, e.g. read the client IP, cookies, the query string, whatnot. Importantly, it is part of the “Old” System.Web assembly, which has been around since .NET 1.1

HttpRequestMessage, on the other hand, is new in .NET 4.5. It is part of System.Net. It can be used both by clients and services to create, send and receive requests and responses over HTTP. It replaces HttpWebRequest, which is obsolete in .NET 4.5

On HttpRequestBase and HttpRequestWrapper, best I can do is to just quote the docs

The HttpRequestWrapper class derives from the HttpRequestBase class and serves as a wrapper for the HttpRequest class. This class exposes the functionality of the HttpRequest class and exposes the HttpRequestBase type. The HttpRequestBase class enables you to replace the original implementation of the HttpRequest class in your application with a custom implementation, such as when you perform unit testing outside the ASP.NET pipeline.

shareedit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s