1

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.

asked May 8, 2013 at 3:23

2 Answers 2

2

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(fs)
 using (sw) {
 sw.WriteLine("hello");
 sw.Flush();
 }
 //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.

answered May 8, 2013 at 8:34
0

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.

answered Aug 6, 2013 at 3:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.