Share via


Basics of .NET Framework Network Operations (Visual Basic)

The Microsoft .NET Framework provides a layered, extensible, and managed implementation of Internet services that can be quickly and easily integrated into your applications. To use these classes, you must fully qualify the names or import the appropriate namespaces by including one or more Imports statements at the beginning of the affected code. For more information, see Imports Statement (.NET Namespace and Type).

Accessing Internet Resources

Three pieces of information are required to access Internet resources through a request/response model. These are provided by specific .NET Framework classes:

  • The Uri class contains the URI (Uniform Resource Identifier) of an Internet resource, which consists of at least three, sometimes four, parts: the scheme identifier, which identifies the communications protocol; the server identifier; the path identifier; and an optional query string.

  • The WebRequest class contains a request for the resource.

  • The WebResponse class provides a container for the incoming response.

Uploading and Downloading Data

For applications that need to make simple requests for Internet resources, the WebClient class provides methods for uploading or downloading data. Because WebClient relies on the WebRequest class to provide access to Internet resources, it can use any registered pluggable protocol.

The System.Net.Sockets namespace provides the TcpClient, TcpListener, and UdpClient classes for applications that do not use the request/response model or applications that need to listen on the network. These classes handle the details of making connections using different transport protocols and expose the network connection to the application as a stream.

For more information, see Requesting Data.

The following table lists common tasks involving requesting data from an Internet resource.

To

See

Create an Internet request

Creating Internet Requests

Send data to the network

Using Streams on the Network

Make asynchronous requests for an Internet resource

Making Asynchronous Requests

Access HTTP-specific properties

HTTP

Associate a specific request to a connection pool

Connection Grouping

Configure a proxy instance

Accessing the Internet Through a Proxy

Make asynchronous requests for an Internet resource

Making Asynchronous Requests

Request data using TCP

Using TCP Services

Request data using UDP

Using UDP Services

Pluggable Protocols

The abstract WebRequest and WebResponse classes provide the base classes for pluggable protocols. By deriving protocol-specific classes from WebRequest and WebResponse, an application can request data from an Internet resource and read the response without specifying the protocol used.

For more information, see Programming Pluggable Protocols.

The following table lists common tasks involving pluggable protocols.

To

See

Derive from WebRequest

Deriving from WebRequest

Derive from WebResponse

Deriving from WebResponse

Access protocol specific properties

How to: Typecast a WebRequest to Access Protocol Specific Properties

Network Tracing

Network tracing provides access to information about invoking methods and information about network traffic generated by a managed application. This feature is useful for debugging applications under development and for analyzing deployed applications. The output provided by network tracing is customizable to support different usage scenarios at development time and in a production environment.

For more information, see Network Tracing.

The following table lists common tasks involving network tracing.

To

See

Enable network tracing

Enabling Network Tracing

Read trace information

Interpreting Network Tracing

Configure network tracing

How to: Configure Network Tracing

Cache Management

A cache provides temporary storage of resources that have been requested by an application. If an application requests the same resource more than once, the resource can be returned from the cache, avoiding the overhead of requesting it again from the server.

A cache policy defines rules that are used to determine whether a request can be satisfied using a cached copy of the requested resource.

For more information, see Cache Management for Network Applications.

The following table lists common tasks involving cache management.

To

See

Set a location-based cache policy

How to: Set a Location-Based Cache Policy for an Application

Set a default time-based cache policy

How to: Set the Default Time-Based Cache Policy for an Application

Customize a time-based cache policy

How to: Customize a Time-Based Cache Policy

Set cache policy for a request

How to: Set Cache Policy for a Request

Security

The System.Net classes provide a secure environment for Internet applications by providing built-in support for commonly used Internet-application authentication mechanisms and for .NET Framework code-access permissions.

For more information, see Best Practices for System.Net Classes.

The following table lists common tasks involving security.

To

See

Use Secure Sockets Layer (SSL) connections to an HTTP server

Using Secure Sockets Layer

Use HTTP authentication methods to establish an authenticated connection to an HTTP server.

Internet Authentication

Set code-access security for applications that use Internet connections.

Web and Socket Permissions

Use Basic and Digest authentication.

Basic and Digest Authentication

Use NTML and Kerberos Authentication.

NTLM and Kerberos Authentication

See Also

Reference

System.Net

System.Net.Sockets

Concepts

Best Practices for System.Net Classes

Configuring Internet Applications

Other Resources

Network Programming