You are on page 1of 3

HowTo: Create a simple ArcGIS Server ASP.

NET web page


Article 28190
ID:

Software: ArcGIS Server 9.0

Platforms N/A
:

Summary
Instructions provided describe how to create a simple ArcGIS Server ASP.NET web page.
For diagnostic purposes it is helpful to use a minimal application, where possible, to test
whether ArcGIS Server and the .NET Application Developer Framework (ADF) are
configured and working properly.

Procedure
Before running this sample the .NET ADF needs to be installed on the web server, ArcGIS
Server needs to be installed and working, and all system requirements need to be met.

1. Create an ASP.NET application directory. This can be done by way of the following
steps:

A. Create a folder under your <drive>:\inetpub\wwwroot directory.


B. Use the IIS Manager to view the properties of the newly created folder.
C. Click on the Create button, on the Directory tab, to create an ASP.NET application.
2. Copy the code below into a text editor and save it as an *.aspx file. Then edit it with
the following modifications:

A. Change the Host attribute in the esri:map tag to be the machine where the ArcGIS
Server Server Object Manager is running.

B. Change the ServerObject to a running MapServer server object. Keep in mind that
the server object names are case sensitive. 'World' is different than 'world'.

3. <%@ Register TagPrefix="esri"


Namespace="ESRI.ArcGIS.Server.WebControls"
4.
Assembly="ESRI.ArcGIS.Server.WebControls, Version=9.0.0.2,
Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" %>
5.

6.
<html>
7.
<head>
8.
</head>
9.
<body>
10.
<form id="WebForm" method="post" runat="server">
11.
<esri:map id="TheMap" UseMIMEData="True" Width="400px"
Height="400px"
12.
style="LEFT: 200px; POSITION: relative; TOP: 30px"
runat="server"
13.
BorderStyle="Solid" BorderColor="200,170,35"
BorderWidth="10px"
14.
ServerObject="PoliticalEarthquakes" Host="tao"
AutoFirstDraw="True">
15.
</esri:map>
16.
</form>
17.
</body>
18.
</html>

19. Create a web.config file in the ASP.NET application directory. A sample web.config
file is shown below.

Configure the file to use an account that is in the agsusers group on the ArcGIS Server
machine.

Storing a username and password in clear text in the web.config file may not be a
secure way to store this information. Microsoft provides mechanisms to encrypt this
information. This example is intended only for diagnostic purposes.

20. <?xml version="1.0" encoding="utf-8" ?>


21.
<configuration>
22.
<system.web>
23.
<!-- Session state must be enabled for the map control -->
24.
<sessionState mode="InProc" />
25.
<identity impersonate="true" userName="SomeDomain\SomeAcct"
password="SomePassword" />
26.
</system.web>

</configuration>

27. Test the application in a browser by typing


http://servername/virtualdirectory/myapp.aspx.

If ArcGIS Server is installed and the .NET ADF is working then a map should appear.
28. When done testing delete the files in the directory - in particular the web.config file if
it contains a clear text password.

You might also like