2013-10-28 89 views
1

嗨我需要檢查siteminder的狀態,看看它是否下降。我目前的解決方案是在指定的環境下ping siteminder的策略服務器。有什麼方法可以檢查Siteminder是否使用c#啓動或關閉?在此先感謝如何使用c檢查siteminder狀態#

回答

0

我有這段代碼轉儲到谷歌文檔從當我在一個項目,使用siteminder一會兒回來。希望它有幫助

String urltest = "https://domain/authentication.fcc?target=https://domain/desired/stats/page.asp"; 

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urltest); 
CredentialCache MyCredentialCache = new CredentialCache(); 
MyCredentialCache.Add(new Uri(uriTeste), "NTLM", new NetworkCredential("user", "password", "domain")); 

req.Credentials = MyCredentialCache; 
req.PreAuthenticate = false; 
req.AllowAutoRedirect = true; 
req.UnsafeAuthenticatedConnectionSharing = true; 
req.Method = "POST"; 
req.Timeout = 100000; 

HttpWebResponse rsp = (HttpWebResponse)req.GetResponse(); 
+0

我會試試這個,非常感謝:) – jhay

+0

你從哪裏得到了uriTeste的價值? – jhay

+0

對不起,uriTeste只是測試www.yoursite.com的網址,所以一個例子是CredentialCache myCache = new CredentialCache(); (新的Uri(「http://www.contoso.com/」),「基本的」,新的NetworkCredential(用戶名,SecurelyStoredPassword)); (新的Uri(「http://www.contoso.com/」),「摘要」,新的NetworkCredential(用戶名,SecurelyStoredPassword,域)); wReq.Credentials = myCache; –