Request to Portal for ArcGIS with security IWA

371
0
03-16-2018 08:35 AM
Alexander_DanielMena
New Contributor III

Hello friends, I need your help.

I have a request to Portal for ArcGIS with IWA setting. The request working in IE (OK) but not in Google Chrome (Error System.Net.WebException: The remote server returned an error: (401) Unauthorized.).

Scenes

1. I set the "defaultnetworkcredencial" in the request. The user is granthed on portal.

HttpWebRequest webRequest = WebRequest.Create(string.Format("{0}{1}",UserEndpoint,username));
webRequest.PreAuthenticate = true;
webRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
webRequest.UnsafeAuthenticatedConnectionSharing = true;
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";

Result:
Response IE. OK.
Response GC. Error System.Net.WebException: The remote server returned an error: (401) Unauthorized.

2. I create a new credential and setting the request.

HttpWebRequest webRequest = WebRequest.Create(string.Format("{0}{1}",UserEndpoint,username));
webRequest.UseDefaultCredentials = false;
webRequest.PreAuthenticate = true;
var c = new NetworkCredential("myusername", "mypass", "mydomain");
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri(string.Format("{0}{1}", UserEndpoint, username)), "NTLM", c);
webRequest.Credentials = credentialCache;
webRequest.UnsafeAuthenticatedConnectionSharing = true;
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";

Result:
Response in IE. OK.
Response in GC. OK.

I need to use the "defautlcredential" in my app (it also use IWA) that work both IE/GC. Any help is apreciated.


Thank you in advanced.

https://community.esri.com/community/gis/web-gis/portal-for-arcgis?sr=search&searchId=7544bc52-c540-...

Tags (2)
0 Kudos
0 Replies