I'm developing an Android application and sending a multipart-form-data HTTP POST to my IIS server. I need to see the raw HTTP message that my server is receiving. For this, in visual studio 2013 I put an interrupt just after this line
public String Report([Bind(Include = "lasfotos,comentario,asunto")] HttpPostedFileBase lasfotos, string comentario, string asunto)
In local variables i can see a lot of information inside this>base>request about the http message like path, content lenght, etc but i can't find where the raw HTTP is.
edit: Why do i think that see the raw http is a solution? because i can easily find my problem here i think. But i will show you my base problem: I have this function in java that send's the data to the server. i can see my variable values (in the server) of "comentario" and "asunto" but "lasfotos" = null
public static String Postear(ArrayList<File> files, String asunto, String detalle)
{
String respuesta;
try
{
String boundary = "qu1ckr3port_myb0undy";
String filesboundary = "boundy_4_files";
URL url = new URL("http://192.168.10.100/QuickReport/Uploads/Report");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.writeBytes("--"+boundary+"\r\n" +
"Content-Disposition: form-data; name=\"lasfotos\"\r\n" +
"Content-Type: multipart/mixed; boundary="+filesboundary+"\r\n\r\n");
for (byte i = 0; i < files.size(); i++)
{
outputStream.writeBytes("--"+filesboundary+"\r\n" +
"Content-Disposition: file; filename=\"" + files.get(i).getName() + "\"\r\n" +
"Content-Type: image/jpeg\r\n\r\n");
FileInputStream fileInputStream = new FileInputStream(files.get(i));
int bytesAvailable = fileInputStream.available();
int bufferSize = Math.min(bytesAvailable, 1024 * 1024);
byte[] buffer = new byte[bufferSize];
int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0)
{
outputStream.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, 1024 * 1024);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
fileInputStream.close();
outputStream.writeBytes("\r\n");
}
outputStream.writeBytes("--"+filesboundary+"--\r\n" +
"--"+boundary+"\r\n" +
"Content-Disposition: form-data; name=\"comentario\"\r\n\r\n" +
detalle + "\r\n" +
"--"+boundary+"\r\n");
outputStream.writeBytes("\r\n" +
"--"+boundary+"\r\n" +
"Content-Disposition: form-data; name=\"asunto\"\r\n\r\n" +
asunto + "\r\n" +
"--"+boundary+"--\r\n");
respuesta = "";
String linea;
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while ((linea = reader.readLine()) != null) respuesta += linea;
reader.close();
outputStream.flush();
outputStream.close();
} catch (Exception e)
{
respuesta = "error";
e.printStackTrace();
}
return respuesta;
}