<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to check if ESRI server is accessible ? in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1238377#M11515</link>
    <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;That's why I want to test the connectivity instead of trying to load the card.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You could start with&amp;nbsp;NetworkInterface.GetIsNetworkAvailable: &lt;A href="https://learn.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getisnetworkavailable?view=net-7.0" target="_blank"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getisnetworkavailable?view=net-7.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Joe's code is doing the same thing - making a request to the service, but won't handle authentication, use etag caching etc, not test if the actual services are up and running (but yes it could be used to see if there's any sort of connection to arcgis.com). The benefit of just loading the map/layers is you won't have to load it later and will save you repeating the requests once you do want to load.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2022 17:14:12 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2022-12-06T17:14:12Z</dc:date>
    <item>
      <title>How to check if ESRI server is accessible ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237745#M11509</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using Esri.ArcGISRuntime 100.14.0 and I wanted to know, before I can display the map to my users, if your servers are accessible or not.&lt;/P&gt;&lt;P&gt;The idea is that if the users don't have internet access, are located in an area where access is filtered or the ESRI servers are inaccessible, I don't want to display access to the map and indicate an error message, rather than risk causing an exception (and I don't want to handle everything in a try/catch).&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 13:55:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237745#M11509</guid>
      <dc:creator>vergerk</dc:creator>
      <dc:date>2022-12-05T13:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if ESRI server is accessible ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237846#M11510</link>
      <description>&lt;P&gt;Just use HttpClient to make a call to the endpoint and see if you get a response or a timeout before trying to load the map.&amp;nbsp; This uses the generic sharing Url, but could use the Url of the basemap itself&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public override async Task&amp;lt;bool&amp;gt; CheckIsConnectedAsync()
{
	try
	{
		var tokenUri = new Uri($"{ConnectionUrl}/sharing/rest?f=json");

		HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(7) };
		var result = await client.GetStringAsync(tokenUri);

		var jsonObject = JsonConvert.DeserializeObject&amp;lt;Dictionary&amp;lt;string, object&amp;gt;&amp;gt;(result);

		return jsonObject.ContainsKey("currentVersion");
	}
	catch ( TaskCanceledException )
	{
		//timeout - server down
		return false;
	}
	catch ( Exception )
	{
		//Can connect but server not fully up and running
		return false;
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using Xamarin the Essentials library has methods to check general device connectivity as a way to look at that.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 16:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237846#M11510</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2022-12-05T16:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if ESRI server is accessible ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237877#M11511</link>
      <description>&lt;P&gt;You could just try and load the map and layers. This will load their metadata - if that fails, the service is most likely down.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            try
            {
                await _map.LoadAsync();
                await Task.WhenAll(_map.AllLayers.Select(l =&amp;gt; l.LoadAsync()));
            }
            catch (Exception ex)
            {
                // Can't load
            }&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1237877#M11511</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-05T17:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if ESRI server is accessible ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1238143#M11513</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;The problem is that the application can be deported on our network and the bandwidth is limited. That's why I want to test the connectivity instead of trying to load the card.&lt;/P&gt;&lt;P&gt;I will test with &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7529"&gt;@JoeHershman&lt;/a&gt;'s solution with the URL to access the ArcGIS service (&lt;A href="https://www.arcgis.com/sharing/rest" target="_blank"&gt;https://www.arcgis.com/sharing/rest&lt;/A&gt; - &lt;A href="https://developers.arcgis.com/net/forms/sample-code/authenticate-with-oauth/" target="_blank"&gt;https://developers.arcgis.com/net/forms/sample-code/authenticate-with-oauth/&lt;/A&gt;) which has the advantage of just testing the connection.&lt;/P&gt;&lt;P&gt;If it doesn't work, I'll try loading the map.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 08:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1238143#M11513</guid>
      <dc:creator>vergerk</dc:creator>
      <dc:date>2022-12-06T08:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if ESRI server is accessible ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1238377#M11515</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;That's why I want to test the connectivity instead of trying to load the card.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You could start with&amp;nbsp;NetworkInterface.GetIsNetworkAvailable: &lt;A href="https://learn.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getisnetworkavailable?view=net-7.0" target="_blank"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getisnetworkavailable?view=net-7.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Joe's code is doing the same thing - making a request to the service, but won't handle authentication, use etag caching etc, not test if the actual services are up and running (but yes it could be used to see if there's any sort of connection to arcgis.com). The benefit of just loading the map/layers is you won't have to load it later and will save you repeating the requests once you do want to load.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 17:14:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-check-if-esri-server-is-accessible/m-p/1238377#M11515</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2022-12-06T17:14:12Z</dc:date>
    </item>
  </channel>
</rss>

