KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Considder the following code: MultipartFormDataContent MPFD = new MultipartFormDataContent(); MPFD.Add(new StringContent(0.ToString()), "doesNotWork"); MPFD.Add(new StringContent(0.ToString()), "works[]"); HttpClient apiClient = new HttpClient(); var Result = apiClient.PostAsync(testurl, MPFD).Result; Console.WriteLine("Response: " + Result.Content.ReadAsStringAsync().Result); This data is then posted to a Generic Handler which does: context.Response.ContentType = "text/plain"; foreach (string key in context.Request.Form.AllKeys) { context.Response.Write(key + ": " + context.Request.Form[key] + Environment.NewLine); } If I do this, only names that end in '[]' are posted, but I also need to be able to post names without the '[]'. Any idea why this behaviour occurs and how to solve it? Note : When using a FormUrlEncodedContent , names without [] do get posted.
Tags (comma-separated)
Save Edits
Cancel