Create an ArcGIS Server Connection file Programmatically

Discussion created by abenvin03 on Feb 18, 2011
Latest reply on Feb 24, 2011 by MNientiedt-esristaff
I'm trying to write a batch Python job that will connect to AGServer to geocode some data. I don't want to store a connection file with this I want to connect dynamically. My Python script calls some C# code that I am writing that accepts the server name and creates a connection. This is all good but apparently I am not smart enough to create a connection file once I have made the connection. I'm sure this must be possible but I'm not finding it in the help.
My code to make the connection is below.

string pServer = "myServer";
IAGSServerConnectionFactory2 AGSConnectionFactory = (IAGSServerConnectionFactory2)new   
IPropertySet2 connectionProps = (IPropertySet2)new PropertySet();
connectionProps.SetProperty("machine", pServer);
IAGSServerConnection3 myAGSConnection = (IAGSServerConnection3)AGSConnectionFactory.Open
          (connectionProps, 0);

At this point I have the connection so I know that works but how do I make a connection file that can then be accessed by Python script?

Any help would be appreciated.