I write an android application that send text data to asp.net webserver. I’m using next code to sent data via Http:
try {
URL url = new URL(serverUrl);
connection = (HttpURLConnection)url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
// Enable POST method
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "text/plain; charset=utf-8");
output = new DataOutputStream(connection.getOutputStream());
String finalUri = sendedUrl.replace("gaburl", "");
output.writeChars(finalUri);
//Toast.makeText(context, finalUri, 1000).show();
output.flush();
output.close();
}
catch(Exception e) {
Toast.makeText(context, e.toString(), 5);
}
How I can receive and display data sending by output.writeChars(finalUri) method in ASP.NET application ? This process should executing like descripe bellow:
1)We have asp.net forms that are a target of sender’s android method desripe earlier;
2)Forms should read string data that sent to it and display it.
Help please
1 Answer