Problem while sending data to server
<p>I am sending a String to a server which contains emailid and password and on successful response should be an xml string.But in my case I am getting null as a response when I enter right emailid and password. Response Code is 302 and Response Message is Moved Temporarily.
And on wrong email or password server give correct message Login Failed.</p>

<p>with same server my iPhone code works as desirable but not in Android.</p>

<p>I have tried my code with another server also there it works fine.
What is the problem with it?
Please Help Me.</p>

<p>My Code is  </p>

<pre><code>import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import android.util.Log;


public class Send_SignInData_ToServer 
{
        private String password_str;
        private String email_str;

        public String sendData(String email_id,String password)
        {  
                Log.e("------------", ".........................................................................................");        
                Log.v("--&gt;", "Send_SignInData_ToServer STARTING sendData()");
                Log.v("WHERE " ,"Send_SignInData_ToServer sendData()");
                String server_message ="";

                email_str = email_id;
                password_str = password;
                System.out.println("emailid = "+ email_str + " Password= "+password_str);
                  try
                  {

                    URL                url; 
                    URLConnection      urlConn; 
                    DataOutputStream   dos; 
                    DataInputStream    dis;



                    String server_url_string = "server_url";


                    Log.i("SERVER URL ",server_url_string);
                    url = new URL(server_url_string);
                    urlConn =  url.openConnection();
        //            HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
                    urlConn.setDoInput(true); 
                    urlConn.setDoOutput(true); 
                    urlConn.setUseCaches(false); 
                    urlConn.setRequestProperty ("METHOD", "POST");

                    dos = new DataOutputStream (urlConn.getOutputStream());



           //String data_to_be_send = "signupdata=EMAIL_ADDRESS="+email_str+":oompPASSWORD="+password_str;
           String data_to_be_send ="Authentication=dealsusername="+email_str+":dealspassword="+password_str;

            Log.i("SENDING DATA ",data_to_be_send);
                   dos.writeBytes(data_to_be_send); 

                    dos.flush(); 
                    dos.close();




                    dis = new DataInputStream(urlConn.getInputStream()); 
                    server_message = dis.readLine(); 
                    Log.i("SERVER RESPONSE",server_message+"");

                    dis.close(); 
                  } // end of "try"


                  catch (MalformedURLException mue) 
                  { 
                          Log.i("EXCEPTION GENERATED MalformedURLException", " "+mue.getMessage());

                  } 
                  catch (IOException ioe) 
                  { 
                          Log.i("EXCEPTION GENERATED IOException ", " "+ioe.getMessage());
                  }

                 /* catch (Exception e) 
                  { 
                          Log.i("EXCEPTION =", " "+e.getMessage());

                  } */

                  Log.i("--: RETURNING :--", "server_message = "+server_message);
                  Log.v("&lt;--", "Send_SignInData_ToServer ENDING sendData()");
                  return server_message;

                }  // end of sendData() method 



}
</code></pre>
