C# UIWebView中的Windows身份验证url无响应、无错误、请求-Xamarin.iOS
我正在尝试在UIWebView中加载windows身份验证url。下面是我的代码C# UIWebView中的Windows身份验证url无响应、无错误、请求-Xamarin.iOS,c#,windows,webview,xamarin.ios,windows-authentication,C#,Windows,Webview,Xamarin.ios,Windows Authentication,我正在尝试在UIWebView中加载windows身份验证url。下面是我的代码 public override void WillSendRequestForAuthenticationChallenge(NSUrlConnection connection, NSUrlAuthenticationChallenge challenge) { if (challenge.ProtectionSpace.AuthenticationMethod == NS
public override void WillSendRequestForAuthenticationChallenge(NSUrlConnection connection, NSUrlAuthenticationChallenge challenge)
{
if (challenge.ProtectionSpace.AuthenticationMethod == NSUrlProtectionSpace.AuthenticationMethodNTLM)
{
if (challenge.PreviousFailureCount > 0)
{
challenge.Sender.CancelAuthenticationChallenge(challenge);
}
else
{
var credentialSpace = new NSUrlProtectionSpace("http://authenticatedurl.com", 80, "http", "http://authenticatedurl.com", "NTLM");
NSUrlCredentialStorage credentialStorage = NSUrlCredentialStorage.SharedCredentialStorage;
var credential = new NSUrlCredential ("username", "password", NSUrlCredentialPersistence.ForSession);
credentialStorage.SetDefaultCredential (credential, credentialSpace);
connection.UseCredential (credential, challenge);
connection.PerformDefaultHandling (challenge);
isAuthenticated = true;
}
}
}
调用上述委托并成功执行UserCredential,但未加载网站。它持续旋转了几个小时。我做错了什么
var credentialSpace=新
NSUrlProtectionSpace(“”,80,“http”,
“NTLM”)
试试这个
var credentialSpace=新
NSUrlProtectionSpace(“authenticatedurl.com”,80,“http”,
“authenticatedurl.com”、“NTLM”)
它应该有用