认证错误

发布于 2024-09-27 07:19:48 字数 1237 浏览 0 评论 0原文

我正在尝试从 Android 应用程序查看需要身份验证的网页,并收到以下消息:

----- Android webView 错误启动 --------

“您无权查看此目录或使用您提供的凭据的页面,因为您的 Web 浏览器正在发送 WWW.Authenticate 标头字段,而 Web 服务器未配置为接受“

HTTP 错误 401.2 = 未经授权:由于服务器配置,访问被拒绝。 Internet 信息服务 (IIS)。

----- Android webView错误结束--------

在Android端我有以下内容: ------- 代码片段开始 -----

public void onCreate(Bundle savingInstanceState) { 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");       

}

------- 代码片段结束 --------

在 IIS 6.0 端的

“身份验证方法”对话框中 取消选中:“启用匿名访问” 检查:“集成Windows身份验证”

当使用“常规浏览器”时,如果我导航到“http://123.example.com/admin/default.aspx”,我会看到一个对话框,要求输入用户名和密码。 一旦进入,我就可以访问该网站。这是我在 Windows 中设置的用户名/密码。

然而,当使用上面的“代码片段”时,我使用相同的用户名和密码得到上面的“错误”。

您能否提供建议或以其他方式引导我走向“正确”的方向。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情未る 2024-10-04 07:19:48

Http 401.2 是 NTLM 挑战响应握手的一部分。

问题是Android不理解如何响应http 401.2。

您可以尝试通过 SSL 进行基本身份验证,而不是集成 Windows 身份验证。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文