使用IHTTPActionResult返回JSONP以获得CORS请求兼容性

时间:2014-02-19 21:41:23

标签: asp.net-mvc jsonp asp.net-mvc-5

有没有办法制作IHTTPActionResult JSONP而不是JSON或XML?

这是我正在尝试返回JSONP的控制器操作:

public IHttpActionResult getCountry()
{
    LocationDB db = new LocationDB();
    try
    {
        IEnumerable<Country> countries = db.getCountries();
        return Ok(countries);
    }
    catch
    {
        return NotFound();
    }
}

}

0 个答案:

没有答案