How to use the new System.Net classes to create an HTTP client

Applies to: Microsoft Visual C# 2005


The CSharpHTTP.exe file sample that is provided through this article shows how to use the new System.Net classes to create an HTTP client that uses the HttpWebRequest and HttpWebResponse classes. This sample shows how to use the following HTTP verbs:
  • HEAD
  • GET
  • POST
  • PUT
It also demonstrates how to handle cookies and certificate errors when you use Secure Sockets Layer (SSL). This sample is based on the VBHTTP sample that is included with the Platform Software Development Kit (SDK).

More Information

The following file is available for download from the Microsoft Download Center:
Release Date: August 23, 2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
The Csharphttp.exe file contains the following files:

Assemblyinfo.cs3 KB
Csharphttp.csproj5 KB
Csharphttp.csproj.user2 KB
Csharphttp.sln1 KB
Csharphttp.suo8 KB
Csharphttp_debug.projdata9 KB
Form1.cs47 KB
Form1.resx2 KB
Licenses.licx2 KB

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners -

Microsoft Advisory Services -

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:;EN-US;CNTACTMS