2
submited我是新的Android编程,并且我尝试提交一些登录数据到一个。 aspx通过POST方法进行验证,我注意到.aspx页面无法从我的android应用程序读取HttpPost数据。 2我已经尝试将我的数据提交到.asp页面,页面能够使用相同的代码读取数据,除了更改其中的URL和第二个。我还创建了一个简单的html文件将数据提交到.aspx页面,读取POST Method数据似乎没有问题,所以现在我不知道这里出了什么问题。Asp.net页面无法读取HttpPost数据时从android
DefaultHttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.mydomain.com/login.aspx");
httppost.addHeader("Content-type", "application/x-www-form-urlencoded");
List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
nvps.add(new BasicNameValuePair("strEmail", username));
nvps.add(new BasicNameValuePair("strPassword", password));
try {
UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps, HTTP.UTF_8);
httppost.setEntity(p_entity);
HttpResponse response = client.execute(httppost);
........
........
ASPX页面bascially什么都不做了,它只是通过的Request.Form(“strEmail”)到Request.Form(“strPassword”)获得数据并将其与数据库,然后回传和XML结果页。那么任何人都有什么想法,那里缺少什么?