【问题标题】:switched from webform to mvc and now can't have android contacting localhost从 webform 切换到 mvc,现在无法让 android 联系 localhost
【发布时间】:2013-08-08 12:42:53
【问题描述】:

我有一个我以前写的测试应用程序。我使用简单的 asp.net webforms 应用程序来执行登录到 android 应用程序。 现在我使用 mvc 重写了 asp.net 应用程序,我将以前的 url 字符串从

<string name="web_login_page">http://10.0.2.2:51469/blabla.com/Account/Android/LoginDroid.aspx</string>

<string name="web_login_page">http://10.0.2.2:52707/Account/Login</string>

运行java代码

String urlToLoginPage = getString(R.string.web_login_page);

webview.loadUrl(urlToLoginPage);

现在 Android 的 webView 抛出:

错误的请求 - 无效的主机名

http 错误 400。请求主机名无效。

试着玩了一下没有成功。有人知道这是什么原因吗?

【问题讨论】:

    标签: android asp.net asp.net-mvc webview


    【解决方案1】:

    替换这个:

    <string name="web_login_page">http://10.0.2.2:52707/Account/Login</string>
    

    <string name="web_login_page">http://your_machine_ip_address/Account/Login</string>
    

    【讨论】:

    • 非常感谢。我试过这个,没有成功。还有其他想法吗?也许是因为 url 的 MVC 形式,即 url 中没有域 'blabla.com'。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-13
    • 1970-01-01
    • 2011-09-30
    • 2019-01-30
    • 2011-04-23
    • 1970-01-01
    • 2012-11-27
    相关资源
    最近更新 更多