I am trying to get POST data in C #, and everything I read says to use
Request.Form["parameterNameHere"]
I am trying to do this, but I am getting an error
System.Net.Http.HttpRequestMessage does not contain a form definition and no extension method for the form. ''
Method in question
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.HttpRequest;
namespace TextServer.Controllers
{
public class TextController : ApiController
{
public HttpResponseMessage Post([FromBody]string value)
{
string val = Request.Form["test"];
HttpResponseMessage response = new HttpResponseMessage();
response.Content = new StringContent("Your message to me was: " + value);
return response;
}
Any help is greatly appreciated.
source
share