This is one use case for ASIWebPageRequest .
If you need a lower level, you need to create an instance of NSURLCredential and NSURLProtectionSpace and store them in the credential storage. At this point, UIWebView should use the credentials for all requests matching the security space (which basically represents your site).
Here is an example of code taken from here that is actually not where I would expect to find it.
NSURLCredential *credential = [[NSURLCredential alloc] initWithUser: @"userName" password: @"password" persistence: NSURLCredentialPersistenceForSession]; NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost: @"www.mydomain.com" port: 80 protocol: @"http" realm: @"mydomain.com" authenticationMethod: NSURLAuthenticationMethodDefault]; [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential: credential forProtectionSpace: protectionSpace]; [credential release]; [protectionSpace release];
source share