Before running this example, you must install. Net ADF on the network server. The ArcGIS Server has been installed and runs properly to meet all system requirements.
1. Create an ASP. NET application directory. You can follow the steps below to create:
(1) create a directory under your directory <drive>: inetpubwwwroot.
(2) Use the IIS manager to view the properties of the newly created directory.
(3) On the directory label, click the create button to create an ASP. NET application.
2. Set the following Code Copy the file to the text editor and save it as a *. aspx file. Edit it as follows:
(1) Change the host attribute in the ESRI: Map label to the machine running ArcGIS Server som (Server Object Manager.
(2) Change serverobject to a running mapserver Server Object. Remember that the name of the server object is case sensitive.
<% @ Register tagprefix = "ESRI" namespace = "ESRI. ArcGIS. server. webcontrols"
Assembly = "ESRI. ArcGIS. server. webcontrols, version = 9.0.0.2, culture = neutral, publickeytoken = 8fc3cc631e44ad86" %>
<HTML>
<Head>
</Head>
<Body>
<Form ID = "webform" method = "Post" runat = "server">
<ESRI: Map id = "themap" usemimedata = "true" width = "400px" Height = "250px"
Style = "Left: 200px; position: relative; top: 30px" runat = "server"
Borderstyle = "solid" bordercolor = "0, 0, 255" borderwidth = "5px"
Serverobject = "China Geological Map" host = "pengling" autofirstdraw = "true">
</ESRI: Map>
</Form>
</Body>
</Html>
3. Create a web. config file under the ASP. NET application directory. The following shows an example of a web. config file.
Use the account in the agsusers group on the ArcGIS Server machine to configure this file.
Writing the user name and password in plain text in the web. config file may not be a security method for storing this information. Microsoft provides an encryption mechanism. This example is only used for diagnosis.
<? XML version = "1.0" encoding = "UTF-8"?>
<Configuration>
<System. Web>
<! -- Session state must be enabled for the map control -->
<Sessionstate mode = "inproc"/>
<Identity impersonate = "true" username = "" Password = ""/>
</System. Web>
</Configuration>
4. Enter http: // servername/virtualdirectory/MyApp. aspx in the browser to test the application. Program .
If ArcGIS Server is installed and. Net ADF works properly, a map is displayed.
5. After the test, delete the files in the directory, especially the Web. config file containing the plaintext password.