You can't return a string on a method which returns an ActionResult, so this is when you could use a ContentResult to return a plain string like so:
public ContentResult Hello()
{
return Content("hello world!");
}
ContentResult by default returns a type of
text/plain
. If you only ever needed to return a string, then you would use the method to return a string
public ActionResult Register()
{
return Content("<tt>sdfsf</tt>","text/xml");
}
public ActionResult Register()
{
return Content("dgdfg","text/json");
}
public ActionResult Register()
{
return Content("dgdfg","text/plan");
}
No comments:
Post a Comment