2
我有一个Web应用程序,我使用Windows凭据自动登录。 我现在想要使用我的Windows帐户在c#windows应用程序中使用此Web应用程序的信息。所以我需要能够从这个网站获得session-cookie。 在这里你可以看到一些我的代码,在这里我要检索的cookie:在C#客户端应用程序中使用Kerberos票据
string URLAuth = extractParameterFromProperties("relatieBeheer_login_url");
WebClient webClient = new WebClient();
webClient.Credentials = CredentialCache.DefaultCredentials;
// webClient.UseDefaultCredentials = true;
byte[] responseBytes = webClient.DownloadData(URLAuth);
//byte[] responseBytes = webClient.UploadValues(URLAuth, "POST", formData);
string resultAuthTicket = Encoding.UTF8.GetString(responseBytes);
if(resultAuthTicket.Contains("Verkeerde combinatie gebruikersnaam")){
sessionCookie="NoSession";
}else{
WebHeaderCollection cookies = webClient.ResponseHeaders;
sessionCookie = cookies[HttpResponseHeader.SetCookie];
}
当我调试应用程序,我什么也看不见填充凭据: 域名,用户名&密码是空的。
任何帮助将是最受欢迎的。
OK,但你的意思是的DefaultCredentials的确应该发送的Kerberos票然后? – user1370849
@ user1370849我相信他们应该与身份验证一起发送,但由于安全原因您无法在变量中看到他们。 –
任何我可以解决这个问题的方法。在wireshark中,我没有看到任何Kerberos票证通过,而当我只是USDàweb浏览器时,我可以看到它通过 – user1370849