Udostępnij za pośrednictwem


MapsGeolocationClient.GetCountryCode(IPAddress, CancellationToken) Method

Definition

This service will return the ISO country code for the provided IP address. Developers can use this information to block or alter certain content based on geographical locations where the application is being viewed from.

public virtual Azure.Response<Azure.Maps.Geolocation.CountryRegionResult> GetCountryCode (System.Net.IPAddress ipAddress, System.Threading.CancellationToken cancellationToken = default);
abstract member GetCountryCode : System.Net.IPAddress * System.Threading.CancellationToken -> Azure.Response<Azure.Maps.Geolocation.CountryRegionResult>
override this.GetCountryCode : System.Net.IPAddress * System.Threading.CancellationToken -> Azure.Response<Azure.Maps.Geolocation.CountryRegionResult>
Public Overridable Function GetCountryCode (ipAddress As IPAddress, Optional cancellationToken As CancellationToken = Nothing) As Response(Of CountryRegionResult)

Parameters

ipAddress
IPAddress

The IP address. Both IPv4 and IPv6 are allowed.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to