There's no much point in doing that, because View
should be generating html, not the controller. But anyways, you could use Controller.Content method, which gives you ability to specify result html, also content-type and encoding
public ActionResult Index()
{
return Content("<html></html>");
}
Or you could use the trick built in asp.net-mvc framework - make the action return string directly. It will deliver string contents into users's browser.
public string Index()
{
return "<html></html>";
}
In fact, for any action result other than ActionResult
, framework tries to serialize it into string and write to response.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…