ฉันต้องการให้ตัวควบคุมตัวอย่างด้านล่างส่งคืนรหัสสถานะ 418 ที่ไม่มีเนื้อหา การตั้งรหัสสถานะนั้นง่ายพอสมควร แต่ดูเหมือนว่ามีบางอย่างที่ต้องทำเพื่อส่งสัญญาณการสิ้นสุดคำขอ ใน MVC ก่อน ASP.NET Core หรือใน WebForms ที่อาจมีการเรียกใช้Response.End()แต่มันทำงานอย่างไรใน ASP.NET Core ที่Response.Endไม่มีอยู่?
public class ExampleController : Controller
{
    [HttpGet][Route("/example/main")]
    public IActionResult Main()
    {
        this.HttpContext.Response.StatusCode = 418; // I'm a teapot
        // How to end the request?
        // I don't actually want to return a view but perhaps the next
        // line is required anyway?
        return View();   
    }
}