を拒否されています。しかし、私はそれを使用したくないです。 :クロスドメインコールエラー:XMLHttpRequestを:ネットワークエラー0x80070005と、アクセスは、実際のユーザー名とパスワードを使用して動作するコードの下にはMVC Asp.Net</p> <p>を使用して
$.ajax({
type: 'POST',
url: Url,
processData: false,
contentType: 'application/json; charset=utf-8',
dataType: 'jsonp',
crossDomain: true,
jsonpCallback: 'CallBackMethod',
success: function (json) {
console.log(json);
},
error: function (xhr, textStatus, errorThrown) {
console.log(errorThrown);
}
});
しかし、以下のエラーを取得:
WebClient client1 = new WebClient();
client1.Credentials = new NetworkCredential("actualUserName", "actualPassword");
string code1 = client1.DownloadString(@"http://Domainname/GetValue");
には、JavaScriptのアプローチを試みたのWebConfigにApplication_BeginRequestと同様のエントリでのGlobal.asaxにヘッダーを追加しようとした
Multiple Access-Control-Allow-Origin headers are not allowed for CORS response.
XMLHttpRequest: Network Error 0x80070005, Access is denied.
。
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}
上記はすべて試されていて、Win7マシンでは動作しません。しかし、Win10マシンからの作品!また、サーバーにデプロイしようとしましたが、チェックされましたが、同じエラーがポップアップします。