您可以使用
ContentResult返回一个纯字符串:
public ActionResult Temp() { return Content("Hi there!");}ContentResult默认情况下返回a
text/plain作为其contentType。这是可重载的,因此您还可以执行以下操作:
return Content("<xml>This is poorly formatted xml.</xml>", "text/xml");
您可以使用
ContentResult返回一个纯字符串:
public ActionResult Temp() { return Content("Hi there!");}ContentResult默认情况下返回a
text/plain作为其contentType。这是可重载的,因此您还可以执行以下操作:
return Content("<xml>This is poorly formatted xml.</xml>", "text/xml");