$.ajax({ type: "GET", url: service_url, dataType: "xml", data: "ParamId=" + FormId.value, processData: false, xhrFields: { withCredentials: true }, error: function(XMLHttpRequest, textStatus, errorThrown) { ajaxError(XMLHttpRequest, textStatus, errorThrown); }, success: function(xml) { DoSomething(xml); } });
方法:加上紅色標注部分
參考:https://stackoverflow.com/questions/1002179/how-can-i-pass-windows-authentication-to-webservice-using-jquery
winform調用:
var service=new xxxxService();
service.Credentials = System.NET.CredentialCache.DefaultCredentials;
From:http://www.cnblogs.com/xuejianxiyang/p/7337761.html