locked
The type or namespace name 'JavaScriptResult' could not be found (are you missing a using directive or an assembly reference?) RRS feed

  • Question

  • User2056817590 posted

    The type or namespace name 'JavaScriptResult' could not be found (are you missing a using directive or an assembly reference?)

    Tuesday, April 6, 2021 10:31 AM

All replies

  • User475983607 posted

    JavaScriptResult is an MVC type that is not available in .NET 5 (Core).  

    public IActionResult Index()
    {
        var result = new ContentResult();
        result.Content = "alert('Hello World');";
        result.ContentType = "application/javascript";
        return result;
    }

    Tuesday, April 6, 2021 11:41 AM