Download/Save GP Result

Discussion created by bangel on May 30, 2013
Latest reply on Jun 10, 2013 by bangel
I�??ve created a GP service with files as input and zip file as output (%scratchfolder%), and a Usercontrol\ iCommand add-in for a Silverlight viewer utilizing the script.  The GP works, but I cannot save the output from the Silverlight viewer.  I used the sample Extract Data to download and save the zip file, but I get an �??object not set to instance�?? after saving the  I�??ve checked and the zip exists in the jobs folder, the GP works from catalog and map, but I can�??t access the output using the output url or with the save dialog code.  I have a feeling it�??s something as simple as security, but I thought permissions for the active directory was set during the install.

        void geoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs ev1)
            if (ev1.Parameter is GPDataFile)
                GPDataFile ClipResultFile = ev1.Parameter as GPDataFile;

                if (String.IsNullOrEmpty(ClipResultFile.Url))

                MessageBoxResult res = MessageBox.Show("Data file created. Would you like to download the file?", "Geoprocessing Task Success", MessageBoxButton.OKCancel);
                if (res == MessageBoxResult.OK)
                    WebClient webClient = new WebClient();
                    webClient.OpenReadCompleted += (s, ev) =>
                        streamedDataFile = ev.Result;
                    webClient.OpenReadAsync(new Uri((ev1.Parameter as GPDataFile).Url), UriKind.Absolute);

                    mywindow = mywindow ?? new ExtractAsbuilts();
                    MapApplication.Current.ShowWindow("Selected Asbuilts", mywindow);
        private void SaveButton_Click(object sender, RoutedEventArgs e)
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultFileName = "";
            dialog.Filter = "Zip file (*.zip)|*.zip";

            bool? dialogResult = dialog.ShowDialog();

            if (dialogResult != true) return;
                using (Stream fs = (Stream)dialog.OpenFile())
                    streamedDataFile = null;
            catch (Exception ex)
                MessageBox.Show("Error saving file :" + ex.Message);

What I�??m really looking for is a shove in the right direction.  All I need to do is save my output from a Silverlight web app.