I created a service which accept user inputs as xml and if any parameters is missing a view must me returned which allows user to enter the missing details.
So i thought it is impossible to return view using api controller so i used mvc controller. But the following error is shown when i read xml.
C# does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type could be found (are you missing a using directive or an assembly reference?)
this is my code
public class MyController : Controller
{
public IHttpActionResult MyService([FromUri] TestProperty testProperty)
{
string DataXML = this.Request.Content.ReadAsStringAsync().Result;
}
}
My questions are
1.How to solve this error?
2.Is there any other ways to accomplish my need using api controller? Returning view to user and accept xml.
System.Web
&System.Net.Http
assembly added in your project ?