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 |
|
Send data to the network |
|
Make asynchronous requests for an Internet resource |
|
Access HTTP-specific properties |
|
Associate a specific request to a connection pool |
|
Configure a proxy instance |
|
Make asynchronous requests for an Internet resource |
|
Request data using TCP |
|
Request data using UDP |
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 |
|
Derive 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 |
|
Read trace information |
|
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 |
|
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 |
|
Use HTTP authentication methods to establish an authenticated connection to an HTTP server. |
|
Set code-access security for applications that use Internet connections. |
|
Use Basic and Digest authentication. |
|
Use NTML and Kerberos Authentication. |
See Also
Reference
Concepts
Best Practices for System.Net Classes
Configuring Internet Applications