如何在.net中进行跨域请求

时间:2011-10-24 15:15:52

标签: asp.net cross-domain

我正在尝试创建跨域请求,但我正在

XMLHttpRequest cannot load [domain]/page.aspx?callback=jQuery1510773820479400456_1319466915384&_=1319466916554. Origin [domain] is not allowed by Access-Control-Allow-Origin.

here is how I make the call

$.ajax({
    url: "domain/page.aspx?callback=?",
    dataType: 'jsonp',
    processData: false,
    success: function (data) {
        /*
        * do something
        */
    }
})

Nn服务器端我添加标题

Response.AppendHeader("Access-Control-Allow-Origin", "[domain]");
//I also tried Response.AppendHeader("Access-Control-Allow-Origin", "*");
Response.AppendHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");

我错过了什么吗?

由于

0 个答案:

没有答案