Open htaccess Password Protected Web-Page in UIWebView


In some cases we want to access a password protected (htaccess) webpage from UIWebView iPhone.
So for this we need add username and password between 'http://' and 'page url'. 
e.g. @"http://username:password@192.165.1.11/mypage"


NSString *url = @"http://username:password@192.165.1.11/mypage";
[webViewForhtaccessPageRendering loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: url]]];

here webViewForhtaccessPageRendering is UIWebVIew.

Comments

  1. Excellent, thanks ! This solution work with swift 2 too !

    ReplyDelete

Post a Comment

Popular posts from this blog

UITableView - Add or Remove Rows Dynamically (Objective C & Swift Source codes)

payUmoney Payment Gateway Integration in iOS App (Objective C)

Check Internet Connectivity Using AFNetworking 2.0