Retrieving a username password in an asp.net web form submitted from an Android application.

I successfully submitted (username / password) and received (true / false) values ​​from my Android application to the .php page. Now I am trying to replace the php page with an aspx page. I am having problems getting data on the Asp.net page (Android application on the asp.net page), so PLS will help me in this regard on the asp.net page.

My Android code is as follows:

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(); } } 
+4
source share
1 answer

// Successful asp.net code looks like this:

  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(); } } 
+2
source

Source: https://habr.com/ru/post/1395914/


All Articles