I've tried the following in my C# Controller
used the following namespaces
 using System;
 using System.Web;
 using System.Web.Mvc;
and the following "things" inside IActionResult Create() method
    // GET: Movies/Create
    public IActionResult Create()
    {
        Request.IsAjaxRequest(); // this line tells me "HttpRequest does not contain a defintion for IsAjaxRequest .. (are you missing a using directive?)"
        string method = HttpContext.Request.Method;
        string requestedWith = HttpContext.Request.Headers["X-Requested-With"];
        HttpContext.Request.Headers["X-Requested-With"] == "XMLHttpRequest";
        new HttpRequestWrapper(System.Web.HttpContext.Current.Request).IsAjaxRequest()
        return View();
    }
None of them works for me. I can debug the request but I can not find anything telling me this is a xhr or XMLHttpRequest.
I'm calling the controller action like so:
function reqListener () {
    console.log(this.responseText);
}
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "https://localhost:5001/Movies/Create");
oReq.send();
The browser dev tools tell me it is a XHR Type Request:

How can I detect the XHR request in a C# Controller or in a .cshtml file?