ESRI.ArcGIS.ADF.Web.UI.WebControls.Layout
VirtualDirectory Property
See Also 
ESRI.ArcGIS.ADF.Web.UI.WebControls.Layout Namespace > PageLayout Class : VirtualDirectory Property




The path to the virtual directory in which images can be written, for example, ~/output/. Output directory must exist on disk at the location the virtual directory maps to.

Syntax

Visual Basic (Declaration) 
<ResCategoryAttribute("Image Output")>
<BindableAttribute(True)>
<ResDescriptionAttribute("The path to the virtual directory in which images can be written. e.g. ~/.")>
<PersistenceModeAttribute()>
<NotifyParentPropertyAttribute(True)>
Public Overridable Property VirtualDirectory As String
Visual Basic (Usage)Copy Code
Dim instance As PageLayout
Dim value As String
 
instance.VirtualDirectory = value
 
value = instance.VirtualDirectory
C# 
[ResCategoryAttribute("Image Output")]
[BindableAttribute(true)]
[ResDescriptionAttribute("The path to the virtual directory in which images can be written. e.g. ~/.")]
[PersistenceModeAttribute()]
[NotifyParentPropertyAttribute(true)]
public virtual string VirtualDirectory {get; set;}

Remarks

If the UseMimeData property is false (default for that property is true), the VirtualDirectory property may be used for map output. See UseMimeData for a discussion of whether the VirtualDirectory will actually be used for map output. Generally, VirtualDirectory will only be used if UseMimeData is false and either Web-tier blending is used or a map service used in the Web application only outputs images as streamed data.

If the Web application actually uses the VirtualDirectory, then map images are written out to the directory and browsers retrieve the images from this directory. To accomplish this, the Web ADF application maps the VirtualDirectory location to a physical path on disk. The Web application writes the map image to the disk. It then passes the URL of the image to the browser. The browser retrieves the image from the Web server via the URL.

Some examples for values of VirtualDirectory:

  • ~/output/ - images are written to the "output" folder inside the Web application. The "~/" notation refers to the Web application's path. For example, if the Web application is physically at C:\Inetpub\wwwroot\WaterApps\WaterWebApp, then the output directory will be C:\Inetpub\wwwroot\WaterApps\WaterWebApp\output. See discussion below before using a website subfolder.
  • /arcgisoutput/ - if ArcGIS Server is installed on the Web server, you can use the server's output folder for the Web applications as well. By default, the ArcGIS Server install creates this virtual directory and creates the physical path in C:\arcgisserver\arcgisoutput. Custom output folders can also be created in ArcGIS Server; see ArcGIS Server Help for details.
  • /output/ - if ArcIMS is installed on the Web server, you can use the ArcIMS output directory for Web application output. This physical directory is cleaned up as long as the ArcIMS Tasker service is running on the Web server.
  • /customOutputFolder - any virtual directory may be used, as long as it has been added to the IIS server and exists on disk. See the discussion below on directory permissions and cleanup.

The VirtualDirectory must use a path relative to the current Web server. You cannot use a full URL path, such as http://myserver.company.com/output, even if the server is the same as the current Web server. Instead, the path must be a path relative to the web application (~/...), or start at at the root of the Web server (/dirname...), or use a relative path (../someotherdir).

The output directory must exist

The VirtualDirectory must map to a physical path on disk, whether on the local machine or on a network machine (using the IIS option to use a UNC share for a virtual directory). The output directory must exist prior to running the Web application; the application will not create the directory, and will throw a runtime error if it does not exist.

If using a file-based (Cassini) website, you cannot use an absolute or relative path to the local IIS server. For example, if your website executes on the address http://localhost:1694/, a VirtualDirectory path of /arcgisoutput/ will fail because the Web application attempts to map the path using the private port of the website, i.e., http://localhost:1694/arcgisoutput/. This actually maps to an arcgisoutput subdirectory of the web application itself. You will either need to use a subdirectory of the website (e.g., ~/output/), or convert your application to use an IIS server.

Permissions on the output directory

The process running the Web application must have permissions to write to the output directory. By default, Web applications run under the Network Service account (on Windows Server 2003) or ASPNET account (on Windows XP). If the application uses impersonation (for example, you set an ArcGIS Identity, or use an ArcGIS Local service in a Manager-created application), then the account used for impersonation must have write permissions to the output directory.

Images are not automatically deleted

The Web ADF and application do not clean up images written to disk when the VirtualDirectory is used. After the browser has retrieved the map image, it is no longer needed and should be deleted to recover the disk space. Some options for removing map images include:

  • If ArcIMS is installed on the Web server, use the ArcIMS output directory (e.g., /output/). The ArcIMS Tasker service cleans up images based on age, by default after 10 minutes. The ArcIMS Tasker service can be customized to clean up additional directories. See ArcIMS Help for information on configuring file cleanup.
  • Create a custom batch file or script that cleans up the directory. This batch file can be set as a scheduled task in your Windows operating system.
  • Manually delete files on a periodic basis.

Performance can degrade if output files accumulate excessively in the output directory.

See Also

© 2010 All Rights Reserved.