How to enable cross origin requests in ASP.NET MVC : <p>I am trying to create a web application which works with cross-origin requests (CORS) in MVC 5. I have tried everything without any result.</p>

<p><strong>With an attribute</strong> </p>

<pre><code>public class AllowCrossSiteJsonAttribute: ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
            filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");

        base.OnActionExecuting(filterContext);
    }
}
</code></pre>

<p><strong>With EnableCors attribute</strong> </p>

<pre><code> [EnableCors("*")]
</code></pre>

<p>Nothing works I'm starting to think that it is impossible</p>
