安卓利用HTTPCLIENT向C#的ashx服务器交付一个图片

安卓利用HTTPCLIENT向C#的ashx服务器提交一个图片
public HttpHelp() {
myRunnable = new Runnable() {
@Override
public void run() {
myClient = new DefaultHttpClient();
Message msg = new Message();
Bundle bundle = new Bundle();
HttpResponse response = null;
HttpRequestBase myreq = null;
myreq = new HttpPost(url);
try {
                              //这里是把图片传到ashx里面,这种写法对吗?
                                 MultipartEntity mulentity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); 
String path = Environment.getExternalStorageDirectory()+ "/DCIM/Camera/1.png";
File file = new File(path);
if (file != null && file.exists()) {
mulentity.addPart("file", new FileBody(file));
}
((HttpPost) myreq).setEntity(mulentity);
}
}
try {
response = myClient.execute(myreq);

int res = response.getStatusLine().getStatusCode();
if (res != HttpStatus.SC_OK) {
msg.what = WebSerState.Fail;
} else {
msg.what = WebSerState.Succeed;
HttpEntity entity = response.getEntity();
if (entity != null) {
try {
      else {
                                                      //这里是返回的数据,返回的是这张图片的2进制流,这里写对吗
   InputStream in = entity.getContent(); 
    byte[] mcon=CameraDlg.readStream(in);
   bundle.putByteArray(ResTag,mcon);
}
}
}

};
}

上面原本代码很多,我把一些东西删了 比如那些上面catch之类的,方便观察.....

在activity的会执行这个函数

 public void my(Bundle bundle)
{
   byte[] a=bundle.getByteArray(HttpHelp.ResTag);  //这个有值的,但是貌似那数组跟原来的都不一样了,我观察要是图片的 人家是什么 1~10000 然后又10000-20000 之类的,但是我调试我发现这个直接就是一排数组,长度才13....
 int ad=a.length;
   Log.i("t460470591",ad+"");
   Bitmap aw=  BitmapFactory.decodeByteArray(a, 0, a.length); //我观察了好几次 这个值是null
  ImageView aA=  (ImageView) findViewById(R.id.s);
  aA.setImageBitmap(aw);
   
}


下面是C# ashx的接收方法

if (context.Request.Files.Count > 0)
            {
                context.Response.ContentType = "image/jpeg";
                HttpFileCollection files =context.Request.Files;
                HttpPostedFile img=files.Get(0);
                byte[] bytes = new byte[img.ContentLength];
               using (BinaryReader reader = new BinaryReader(img.InputStream, Encoding.UTF8))
               {
                   bytes = reader.ReadBytes(0);
              }
          //我这里要把接收的图片 转为2进制,存到数据库


               context.Response.OutputStream.Write(bytes,0,img.ContentLength); //这句话的意思是,我吧图片转成了2进制然后返回到安卓,安卓接收了,看看能不能把二进制在转到图片,结果就失败了,就出现了上面那问题
                return;
              
            }


------解决方案--------------------
看看是不是客户端编码的问题