Every web application in ASP.NET runs with a specific identity. This identity is based on a user account on the local machine or domain. The application uses this identity when it accesses resources on disk or services. If the account does not have rights to the resource, the web application will not be able to use the resource.
By default, ASP.NET applications run under a common account, typically ASPNET (for Windows XP) or Network Service (for Windows Server 2003). These accounts have limited permissions to use disk and service resources. They do not, for example, have the ability to access ArcGIS Server local data sources.
Impersonation is where the web application assumes a different identity from the default. Impersonation enables the application to access resources available to the account used in the impersonation. To access ArcGIS Server local data sources, for instance, the web application must impersonate a user in the agsusers or agsadmin group.
Impersonation can be configured to be used for the web application on startup, by adding an <identity> tag to the web.config file. Impersonation can also be implemented dynamically in code, so that it can be turned on and off as needed.
The following table describes the identity of the Web application process
depending on some common IIS and ASP.NET settings:
| Operating System | IIS Settings | ASP.NET Settings | Identity | |
|---|---|---|---|---|
| Anonymous | Integrated | Impersonate in Web.Config | ||
| Windows 2000 | Either | Either | ASPNET | |
| Yes | Either | True | IUSR_<machinename> | |
| No | Yes | True | Browser user | |
| Either | Either | True with defined user | User in Web.Config | |
| Windows XP | Either | Either | ASPNET | |
| Yes | Either | True | IUSR_<machinename> | |
| No | Yes | True | Browser user | |
| Either | Either | True with defined user | User in Web.Config | |
| Windows 2003 | Either | Either | NETWORK SERVICE | |
| Yes | Either | True | IUSR_<machinename> | |
| No | Yes | True | Browser user | |
| Either | Either | True with defined user | User in Web.Config | |
Setting the ArcGIS identity using Visual Studio
The easiest approach for setting the identity is to use a Visual Studio context menu that was added and configured when the Web ADF was installed. To use this approach:
Setting the ArcGIS identity manually
If Visual Studio is not available on the Web server computer, you can manually set or update the ArcGIS identity.
<identity configProtectionProvider="DataProtectionConfigurationProvider">
<EncryptedData>
<CipherData>
<CipherValue>AQA…vA==</CipherValue>
</CipherData>
<EncryptedData>
</identity>
<identity impersonate=”true” userName=”mydomain\myusername” password=”mypassword” />If using a local machine account, the domain name (mydomain) may be omitted from the userName value, or the local machine name may be used. If the Web server and GIS server are on separate machines, you must omit the machine name for local accounts.
aspnet_regiis -pe "system.web/identity" -app "/MyWebMappingApp" -prov "DataProtectionConfigurationProvider"where "/MyWebMappingApp" is the URL of the web application on the local IIS server.
aspnet_regiis -pef "system.web/identity" "C:\MyWebFolder\MyWebMappingApp" -prov "DataProtectionConfigurationProvider"The above examples use the .NET DataProtectionConfigurationProvider, which uses a machine-specific key for encryption. If you need to deploy the same application to multiple servers, such as in a Web Farm, you should use the RSAProtectedConfigurationProvider, which allows export and import of encryption keys. See this Microsoft article for details: How To: Encrypt Configuration Sections in ASP.NET 2.0 Using RSA.
An alternative option to the encryption with aspnet_regiis is to encrypt the credentials for the identity within the Registry. To do this, use the Aspnet_setreg utility. This utility is available, with instructions, from Microsoft at http://support.microsoft.com/default.aspx?scid=kb;en-us;329290.