I am trying to view a web page, fron an Android app, that requires authentication and get the following message:
----- Android webView error start --------
"You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending WWW.Authenticate header field that the Web server in not configured to accept"
HTTP Error 401.2 = Unauthorized: Access is denied due to the server configuration. Internet Information Services (IIS).
----- Android webView error end --------
On the Android side I have the following: ------- code snip start -----
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
// web view
webView = (WebView) findViewById(R.id.web_view);
webView.getSettings().setJavaScriptEnabled(true);
webView.setHttpAuthUsernamePassword("123.example.com", "", "username", "password");
// webView.setHttpAuthUsernamePassword("123.example.com/admin.default.aspx", "", "username", "password");
webView.loadUrl("http://123.example.com/admin/default.aspx");
}
------- code snip end --------
On the IIS 6.0 side
in the "Authentication Methods" dialog box Uncheck: "Enable anonymous access" Check: "Integrated Windows authentication"
When using a "regular Browser" if I navigate to "http://123.example.com/admin/default.aspx" I get a dialog box asking for username and password. Once entered I have access to the site. It is a user name/password I have set up in Windows.
However when using the above "code 开发者_开发问答snip" I get the above "error", using the same username and password.
Can you please offer advise or otherwise steer me in the "right" direction.
The Http 401.2 is part of the NTLM Challenge response handshake.
The problem is that Android does not understand how to respond to the http 401.2.
You could try Basic Authentication over SSL instead of the Integrated Windows Authentication.
精彩评论