Is HttpWebRequest class deprecated/obsolete?

HttpWebRequest class is not deprecated, only its constructors are. It is still recommended to use HttpWebRequest for sending POST, GET, PUT etc to REST API. HttpWebRequest class itself is not obsolete.

Do not use the HttpWebRequest constructor. Use the WebRequest.Create method to initialize new HttpWebRequest objects. If the scheme for the Uniform Resource Identifier (URI) is http:// or https://, Create returns an HttpWebRequest object.

var request = (HttpWebRequest)WebRequest.Create("http://www.example.com/restapi_endpoint");

More Information https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

HttpWebRequest()

Obsolete. Initializes a new instance of the HttpWebRequest class.

System_CAPS_protmethod HttpWebRequest(SerializationInfo, StreamingContext)

Obsolete. Initializes a new instance of the HttpWebRequest class from the specified instances of the SerializationInfo and StreamingContext classes.

Add Comment