Accessing ArcGIS Geoprocessing Service with Security .NET

Discussion created by mkoneya on Jun 9, 2011
Latest reply on Jun 9, 2011 by ldonahue
I have published a Toolbox to ArcGIS Server as a geoprocessing service and am trying to access the service via .NET.    I get an error message telling me the job has failed after running the following code: 

Geoprocessor gp = new Geoprocessor();
                     gp.OverwriteOutput = true;

            IVariantArray parameters = new VarArrayClass();
            IGeoProcessorResult result;
            result = (IGeoProcessorResult)gp.Execute("AddLayerToMap", parameters, null);

The ArcGIS Server has ArcGIS Server security in place and this looks like the problem because if I access the toolbox directly via its location on disk, the code works.   

How do I pass credentials to an ArcGIS Server Geoprocessing Service?