<?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: Check If Portal Connection Is Valid in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161694#M10887</link>
    <description>&lt;P&gt;That is a solution that works for me.&amp;nbsp;Thank you very much for your time.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 16:58:38 GMT</pubDate>
    <dc:creator>sgn_GSI</dc:creator>
    <dc:date>2022-04-06T16:58:38Z</dc:date>
    <item>
      <title>Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1159419#M10872</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;After creating a new instance of the ArcGISPortal class, is there a way to check if the connection is still valid? I see that I could check the ExpirationDate of the Credentials. However, that does not help for checking for the scenarios where the user's internet connection drops out or the server hosting their ArcGIS Enterprise is down. Thank you very much for your time.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 14:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1159419#M10872</guid>
      <dc:creator>sgn_GSI</dc:creator>
      <dc:date>2022-03-30T14:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1159627#M10875</link>
      <description>&lt;P&gt;I basically just ping the portal and see if I get a response.&amp;nbsp; I have this run in the background and it sets a flag that I check before doing something that requires a connection&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);
            //just something I know is in the return json
		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;</description>
      <pubDate>Wed, 30 Mar 2022 20:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1159627#M10875</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2022-03-30T20:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1160226#M10876</link>
      <description>&lt;P&gt;Thank you very much for your time. Unfortunately, it does not seem that pinging the server would be a viable solution. Most servers, by default, are configured to deny ICMP echo requests when a server is pinged. Configuring the servers to allow a response to be sent back could pose a security risk.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 12:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1160226#M10876</guid>
      <dc:creator>sgn_GSI</dc:creator>
      <dc:date>2022-04-01T12:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1160298#M10877</link>
      <description>&lt;P&gt;I did not mean ping in the literal sense of sending an ICMP request.&amp;nbsp; It was just meant in a generic way, as send a request to the server and see if you get a response from the server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you look at the code sample it shows that a standard request over 443 is being sent.&amp;nbsp; The same as any request that is being sent to portal.&amp;nbsp; Just it requests a very generic reply which can be checked or you can see if it times out instead of getting a reply.&amp;nbsp; In my case I have this run continuously in the background.&amp;nbsp; This way prior to doing any operation that requires a connection there is confirmation that a connection to the portal is available.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 15:35:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1160298#M10877</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2022-04-01T15:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161018#M10880</link>
      <description>&lt;P&gt;To find out when the network status changes (and then use an approach like &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7529"&gt;@JoeHershman&lt;/a&gt;'s) you might be able to use something like the&amp;nbsp;&lt;A title="NetworkChange.NetworkAvailabilityChanged Event" href="https://docs.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkchange.networkavailabilitychanged?view=net-6.0" target="_blank" rel="noopener"&gt;NetworkChange.NetworkAvailabilityChanged Event&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 00:58:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161018#M10880</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2022-04-05T00:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161272#M10882</link>
      <description>&lt;P&gt;For internet/cell connectivity I use the Xamarin.Essentials library Connectivity object&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Connectivity.ConnectivityChanged += OnConnectivityChanged;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 17:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161272#M10882</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2022-04-05T17:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Check If Portal Connection Is Valid</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161694#M10887</link>
      <description>&lt;P&gt;That is a solution that works for me.&amp;nbsp;Thank you very much for your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 16:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/check-if-portal-connection-is-valid/m-p/1161694#M10887</guid>
      <dc:creator>sgn_GSI</dc:creator>
      <dc:date>2022-04-06T16:58:38Z</dc:date>
    </item>
  </channel>
</rss>

