I'm using webview to load a web site. and I managed to run the apps. But my problem Is that I can't load the web site if I pass a wrong password, it only show a white screen.
If I pass the correct username/password, it will load the web site. is there a way to handle my authenticate username/password is correct or wrong?
I'm using this code.
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM])
{
NSURLCredential *credentail = [NSURLCredential
credentialWithUser:@"username"
password:@"Password"
persistence:NSURLCredentialPersistenceForSession];
[[challenge sender] useCredential:credentail forAuthenticationChallenge:challenge];
}}
The correct username and password are included in the code above. If I change the username into "user" or password into "pass", I can't load the web site. How can I catch the authentication error?
thanks.