Chapter 9. Networking and Web

9.0 Introduction

Connectivity is more important than ever in solutions, and the .NET Framework provides a number of ways to help you support that need. .NET provides many lower-level classes to help make network programming easier than many environments that preceded it. There is a great deal of functionality to assist you with tasks such as:

  • Building network-aware applications

  • Downloading files via FTP

  • Sending and receiving HTTP requests

  • Getting a higher degree of control using TCP/IP and sockets directly

In the areas in which Microsoft has not provided managed classes to access networking functionality (such as some of the methods exposed by the WinInet API for Internet connection settings), there is always P/Invoke, so you can code to the Win32 API, as we’ll explore in this chapter. With all of the functionality at your disposal in the System.Net namespaces, you can also write network utilities very quickly.

In addition to the lower-level networking support, .NET embraces the World Wide Web and has incorporated support for the Web into every nook and cranny of what most .NET developers encounter when building their solutions today. Web services (both REST and SOAP based) are in heavy use, and ASP.NET is one of the main players in the web application space. Given the general need to work with HTML and TCP/IP name resolution, and because uniform resource indicators (URIs) and uniform resource locators (URLs) are being used for more and ...

Get C# 6.0 Cookbook, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.