Monday, April 21, 2008

How to find the default SSP with code

Answer: (update - thanks to Gary Lapointe who pointed out that my last post used internal objects, I actually tested my code and did more research and found that there is no way in the API to get to the default. If someone knows of a way I'm happy to learn. for now, here is a workaround that I have found - using the STSADM command line)

Process stsadmProcess;
stsadmProcess = new Process();
stsadmProcess.StartInfo.WorkingDirectory = @"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN";
stsadmProcess.StartInfo.FileName = "stsadm.exe";
stsadmProcess.StartInfo.Arguments = "-o enumssp -default";
stsadmProcess.StartInfo.UseShellExecute = false;
stsadmProcess.StartInfo.RedirectStandardOutput = true;
stsadmOutput = new StringBuilder("");
XmlDocument xdoc = new XmlDocument();

1 comment:

Gary Lapointe said...

These classes are both internal so you'd need reflection to get to them - am I missing something?