我正在尝试存储Windows凭据以登录到Web视图中的Intranet Web应用程序。
var login = Application.Context.GetSharedPreferences("Login", FileCreationMode.Private);
string username = login.GetString("username", null);
string password = login.GetString("password", null);
if (username != null && password != null)
handler.Proceed(username, password);
但是,如果密码错误,它将继续尝试直到帐户被锁定。如何检查Proceed
是否成功,以便重新提示用户输入新的凭据。
答案 0 :(得分:1)
这是我的建议
int requestCount;
public override void OnReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, string host, string realm)
{
requestCount++;
if(requestCount <3)
{
handler.Proceed(username, password);
}
else
{
//show a Dialog(with two edittext for input username and password) which notice credentials failure and reprompt the user to enter in new credentials
//when you click Dialog's "Ok" reset requestCount to 0 and call "handler.Proceed(newUsername, newPassword);"
//when you click Dialog's "Cancel" call "handler.Cancel();"
}
}
答案 1 :(得分:0)
问题是保存了错误的密码。