Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to create a file with an ArcGIS Server Object Extension and return the url. Is this possible? Where would I write the file?

I'm working with .Net, IIS, and AGS 10.1.

share|improve this question
up vote 2 down vote accepted

It is possible. First, you need to register output directory or parent directory as "Data store". Because, ArcGIS Server 10.1 can only access to "Data store" directory. Next, add the output directory as IIS Virtual directory. Then, you can create file to output directory and access it from IIS.

To get more information about Data store, please follow,
Registering your data with ArcGIS Server using Manager

Here is the sample code. This code is from REST template.

private byte[] RootResHandler(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties) {
    responseProperties = null;

    //c:\data is "Data store" directory
    //c:\data\test is "output diretory" and register as IIS virtual directory named "test"
    System.IO.FileStream fs = new System.IO.FileStream(@"c:\data\test\sample.txt", System.IO.FileMode.CreateNew, System.IO.FileAccess.Write);
    System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);

    using (sw) {


    //return url as string value
    JsonObject result = new JsonObject();
    result.AddString("url", "http://<host>/test/sample.txt");

    return Encoding.UTF8.GetBytes(result.ToJson());

Hope this help you.

share|improve this answer

in ags server 10.1, the server directory arcgisserver can be access with the url, you do not need to register it, so i always export a file,special an image file in the arcgisserver directory and then given the url to the client.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.