Java 如何将用户ID和密码从android发送到ASP页面

Java 如何将用户ID和密码从android发送到ASP页面,java,android,asp-classic,send,Java,Android,Asp Classic,Send,我正在尝试为我的大学门户创建一个android应用程序。令人惊讶的是,麦格理大学竟然没有。 目前,我已经创建了一个简单的登录UI、一个学生/员工id文本框字段和一个密码字段。还有一个“登录”按钮 我知道如何从两个文本字段中检索文本,但如何将用户id和密码发送到asp服务器页面,并在检索和显示中检索下一个页面 这一页是 我正在使用http post发送登录凭据 HttpClient client = new DefaultHttpClient(); HttpPost post = new Ht

我正在尝试为我的大学门户创建一个android应用程序。令人惊讶的是,麦格理大学竟然没有。 目前,我已经创建了一个简单的登录UI、一个学生/员工id文本框字段和一个密码字段。还有一个“登录”按钮

我知道如何从两个文本字段中检索文本,但如何将用户id和密码发送到asp服务器页面,并在检索和显示中检索下一个页面

这一页是

我正在使用http post发送登录凭据

HttpClient client = new DefaultHttpClient();  
HttpPost post = new HttpPost("https://portal.sibt.nsw.edu.au/Default.asp");
AVD每次尝试执行此命令时都会崩溃

HttpResponse response = client.execute(post);
注意:这在try/catch()块中

我不知道它为什么每次都会在那里崩溃。

你需要发送到。
this is how you can send username and password and recieve the response

public class callASPX
{
        public static final String URL = "http://localhost:8080/appName/actionOrServletTobeCalled";
    public static void main(String args[])
    {
        callASPXobj = new callASPX();
        String username = "username";
        String password = "password";
        obj.getOutputFromUrl(URL+"?username="+username+"&password="+password);

    }
    public String getOutputFromUrl(String url) 
    {
        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);
        HttpResponse response;
        StringBuilder builder= new StringBuilder();
        BufferedReader in = new BufferedReader(new                            InputStreamReader(response.getEntity().getContent(), "UTF-8"));
        char[] buf = new char[8000];
        int l = 0;
            while (l >= 0) 
            {
                builder.append(buf, 0, l);
                l = in.read(buf);
            }
        return builder.toString();
    }   
}

您可以通过以下方式发现要发送的参数:
-使用google chrome打开您的网站
-按F12键
-选择“网络”
-不要忘记选中“保留导航日志”


祝你好运

谢谢你的帮助,我似乎不明白如何用httpPost发送id和密码。如果你用谷歌搜索“安卓HttpPost”,你可以向我展示10亿个例子:我有,我被代码的一部分卡住了。每次我到达那条线,avd就会崩溃。PS我的问题现在更新为该问题您需要在UI线程中执行它,例如使用AsyncTask。并且您需要在清单中请求INTERNET权限。