ArcGIS Portal layer in ArcGISDynamicLayer

1301
5
Jump to solution
04-12-2021 09:32 AM
jgalarse
New Contributor II

Hi guys, we are trying to add compatibility with ArcGIS Portal on our existing desktop map application that runs ArcGIS Runtime .NET SDK version 10.2.7. I've seen samples on using the ESRI.ArcGISRuntime.Portal.ArcGISPortal to handle this but that would mean that we would need to recreate our controls (i.e. Selection, Identify etc.) from the ground up.

I was wondering if there is a way to consume the ArcGIS Portal layers in a ArcGISDynamicLayer?

 

Thank you!

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

I believe creating an ArcGISDynamicMapServiceLayer (MapServer endpoint) or a FeatureLayer (FeatureServer/<ID>) should work, as long as you have registered an event handler for the IdentityManager ChallengeHandler or you have implemented a workflow for pre-authentication.

View solution in original post

0 Kudos
5 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

You can find the old samples for 10.2.7 in https://github.com/Esri/arcgis-runtime-samples-dotnet/releases/tag/v10.2.7

These include several Portal samples.

 

0 Kudos
jgalarse
New Contributor II

Thanks Michael. I did find these samples before and based some of my test apps on these but they were using the Portal classes which uses webmaps.

Since publishing map services to ArcGIS Portal also creates mapserver/featureserver entries, I thought that maybe I could re-use our existing code (using ArcGISDynamicLayer)  to avoid having to generate a new code set to handle similar scenarios just for Portal layers.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

I believe creating an ArcGISDynamicMapServiceLayer (MapServer endpoint) or a FeatureLayer (FeatureServer/<ID>) should work, as long as you have registered an event handler for the IdentityManager ChallengeHandler or you have implemented a workflow for pre-authentication.

0 Kudos
jgalarse
New Contributor II

Hi Michael, you are right. ArcGISDynamicMapServiceLayer actually works as is. The issue I was encountering was actually related to permission, when I tried to set the Share config on the map to Everyone, the layers loaded as expected. 

I tried using the IdentityManager.Current.GenerateCredentialAsync with my user's credential and added the resulting credential object. I know this user has access because its the same user I used to create/publish the map service. Am I using an incorrect way to authenticate the user?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

That should work, but you could also try the challenge approach to check you're creating the right type of credential. The following samples show handling the challenge, either with known credentials or prompting the user:

0 Kudos