This documentation is archived and is not being maintained.

HttpWebRequest.ServicePoint Property

Gets the service point to use for the request.

Namespace:  System.Net
Assembly:  System (in System.dll)

Public ReadOnly Property ServicePoint As ServicePoint

Property Value

Type: System.Net.ServicePoint
A ServicePoint that represents the network connection to the Internet resource.

The ServicePoint.Address property may be different from HttpWebRequest.Address if the request is redirected.

            Private Shared Sub makeWebRequest(ByVal hashCode As Integer, ByVal Uri As String)
                Dim res As HttpWebResponse = Nothing

                ' Make sure that the idle time has elapsed, so that a new 
                ' ServicePoint instance is created.
                Console.WriteLine("Sleeping for 2 sec.")

                    ' Create a request to the passed URI.
                    Dim req As HttpWebRequest = CType(WebRequest.Create(Uri), HttpWebRequest)
                    Console.WriteLine((ControlChars.Lf + "Connecting to " + Uri + " ............"))

                    ' Get the response object.
                    res = CType(req.GetResponse(), HttpWebResponse)
                    Console.WriteLine("Connected." + ControlChars.Lf)
                    Dim currentServicePoint As ServicePoint = req.ServicePoint

                    ' Display new service point properties.
                    Dim currentHashCode As Integer = currentServicePoint.GetHashCode()
                    Console.WriteLine(("New service point hashcode: " + currentHashCode.ToString()))
                    Console.WriteLine(("New service point max idle time: " + currentServicePoint.MaxIdleTime.ToString()))
                    Console.WriteLine(("New service point is idle since " + currentServicePoint.IdleSince.ToString()))

                    ' Check that a new ServicePoint instance has been created.
                    If hashCode = currentHashCode Then
                        Console.WriteLine("Service point reused.")
                        Console.WriteLine("A new service point created.")
                    End If
                Catch e As Exception
                    Console.WriteLine(("Source : " + e.Source))
                    Console.WriteLine(("Message : " + e.Message))
                    If Not (res Is Nothing) Then
                    End If
                End Try
            End Sub 'makeWebRequest

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.