3

After searching in google and here, i saw the popular approach is to convert the image to byte array and then to base64 string. this part was easy, but sending it and receiving it over HTTP is harder, and I can't find an easy way to do it.

I have 2 main question which depend one another

  1. Send with android on HTTP: Android 6 deprecated HttpClient, so i don't want to use that. I thought to use Volley but i cant figure out how to make it work right. Can you please give me an example of code to transfer it in a simple and elegant way which will be easy to intercept with C#?

  2. Receive with C# and use of web service: I'm not sure what is the best way to implement it? Should I create a web service method? in case i should, how can i intercept the post request? Should I create a new page to handle only this part. this way i know how to handle the request.

Edit:

I managed to create a request using HttpClient, but the base64 string after converting the file made the URI too long. any other ideas?

2 Answers 2

1

I found here a post for uploading files from Android to ASP.NET Web API. However the HTTPClient was used for handling HTTP request but I think you can use code as reference.

Sign up to request clarification or add additional context in comments.

Comments

1

Found the simple and elegant solution i wanted! I use loopj library, "android-async-http" for sending files with 3-4 lines.

Then i get the request to a new aspx file in my ASP.NET server, and save it using "Request.Files" object.

2 Comments

Hi @Gil Can you show the android code and the .NET code?
I moved to a different workplace since, So i don't have the code anymore

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.