When using the ArcGIS Server ArcObjects API, you generally need to connect to the GIS server in local mode. Therefore, there are two classes in version 9.2 that can be connected to the GIS server. One is the ESRI. ArcGIS. server. gisserverconnectionclass class, and the other is the ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection class.
ESRI. arcGIS. server. the gisserverconnectionclass class is encapsulated for the com class.. Net class. When you connect to the GIS server, there is no explicitly specified user. So what users are used to connect to the GIS server? Actually, it is the user of the Web application used. If there is an identity node in Web. config, it will be it. The connection code is as follows:
[C #]
ESRI. ArcGIS. server. gisserverconnectionclass gisconnection;
Gisconnection = new ESRI. ArcGIS. server. gisserverconnectionclass ();
Gisconnection. Connect ("servername ");
ESRI. ArcGIS. server. iserverobjectmanager som = gisconnection. serverobjectmanager;
The ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection class is a pure. Net class. In fact, all classes in the ESRI. ArcGIS. ADF. Connection class library are. Net classes. We recommend that you use agsserverconnection when connecting to the server. This class needs to explicitly specify the identity information. usage is as follows:
[C #]
ESRI. ArcGIS. ADF. Identity identity = new ESRI. ArcGIS. ADF. Identity ("user", "passwd", "Domain ");
ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection agsconnection;
Agsconnection = new ESRI. ArcGIS. ADF. Connection. AGS. agsserverconnection ("hostname", identity );
Agsconnection. Connect ();
Iserverobjectmanager som = agsconnection. serverobjectmanager;