HOW TO

Create a simple ArcGIS Server ASP.NET web page

Last Published: April 25, 2020

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:
    1. Create a folder under your <drive>:\inetpub\wwwroot directory.
    2. Use the IIS Manager to view the properties of the newly created folder.
    3. Click 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:
    1. Change the Host attribute in the esri:map tag to be the machine where the ArcGIS Server Server Object Manager is running.
    2. 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'.
<%@ 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="400px" 
		style="LEFT: 200px; POSITION: relative; TOP: 30px" runat="server"
		BorderStyle="Solid" BorderColor="200,170,35" BorderWidth="10px"
		ServerObject="PoliticalEarthquakes" Host="tao" AutoFirstDraw="True">
	</esri:map>
	</form>
</body>
</html>
  1. 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.
<?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="SomeDomain\SomeAcct" password="SomePassword" />
</system.web>
</configuration>
  1. 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.
  2. When done testing delete the files in the directory - in particular the web.config file if it contains a clear text password.

Article ID:000007489

Software:
  • ArcGIS Server

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic