GIS Server connection woes

Discussion created by cpicciri on Oct 30, 2012
Latest reply on Oct 31, 2012 by cpicciri
Hi everyone,

This is my first attempt to connect to a GIS Server so my error is probably something simple but cannot figure it out. I followed the example in this link: http://edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/ArcGIS/ArcObjects/connect_gis_server.htm

amongst others.

I am using the code below but it fails on the connect line with an error of "Identity Error: Server could not authenticate the supplied identity."

ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("pub", "pub", ".");
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection ags_connection;
ags_connection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("http://services.nationalmap.gov/ArcGIS/services", identity);
IServerObjectManager som = ags_connection.ServerObjectManager;

If I load the layer manually in ArcMap and look at the Source tab for the layer, the info I get is this:

Data Type: ArcGIS Map Service
Connection:   Internet
Server:   http://services.nationalmap.gov/ArcGIS/services
Name:   nhd
User:  pub
Operations Allowed:  Map (Display), Query (Identify), Data (Find)
Map Service Type:  Not Cached
Coordinate System: GCS_WGS_1984
Datum:  D_WGS_1984
Prime Meridian:  0

Can someone point me in the right direction?