简体   繁体   中英

C# deserialization from Java(android) header

I am working on some android project, so i need to send hashtags to the server by Header info.

So this is the server code they have for getting the hashtags.

 if (Request.Headers.Contains("hashtags"))
            newPost.HashTags = new System.Web.Script.Serialization.JavaScriptSerializer()
                 .Deserialize<List<string>>         (Request.Headers.GetValues("hashtags").First());

and i really don't know how to send ArrayList in java side to a single parametar by Headers parametar.

conn.setRequestProperty("hashtags", "");

I guess i need to serialize somehow the list and send it as string?

Please if anyone knows anything share with me, i really appreciate it!

I found a solution

You need to post in this format

["element1","element2","element3"]

in simple String format.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM