gpt4 book ai didi

android - 在从android应用程序发送的asp.net webform中接收用户名密码

转载 作者:太空宇宙 更新时间:2023-11-03 10:28:41 25 4
gpt4 key购买 nike

我已从我的 Android 应用程序成功发送(用户名/密码)和接收(真/假)值到 .php 页面。现在我正在尝试用 aspx 页面替换 php 页面我在 Asp.net 页面(android 应用程序到 asp.net 页面)接收数据时遇到问题,所以请在这方面帮助我使用 asp.net 页面。

我的android代码如下:

    public void postLoginData() {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://xyz/Default.aspx");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("formData1", x));
nameValuePairs.add(new BasicNameValuePair("formData2", y));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

HttpResponse response = httpclient.execute(httppost);
result = inputStreamToString(response.getEntity().getContent()).toString();

} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

最佳答案

//成功的asp.net代码如下:

 public partial class _Default : System.Web.UI.Page 
{
string result,x,y;
protected void Page_Load(object sender, EventArgs e)
{
x = Page.Request.Form["formData1"];
y = Page.Request.Form["formData2"];

if (x == y)
{
result = "true";
}
else
{
result = "false";
}

Response.Write(Server.HtmlEncode(result));
Response.End();
}
}

关于android - 在从android应用程序发送的asp.net webform中接收用户名密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9240342/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com