0
我想打電話給位於一個Web服務器上的Web服務需要Web表單認證調用.NET Web服務從JavaScript
$.ajax({
type: "Get",
url: "http://SomeIPAddressThatIDontWantToShare/WebServices/GetServerData.asmx/GetOPCHist_Last4h",
data: { OPCName: OPCName_Passed, OPCTable: OPCTable_Passed },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$.each(data, function (index, element) {
T1.push([new Date(element.DateAndTime).getTime(), element.T1]);
});
},
error: function (request, status, error) {
alert(request.status + ' ' + request.responseText);
}
})
然而當這樣做它總是命中錯誤狀態爲「0」,沒有響應文本。在點擊頁面之前,我在瀏覽器上手動驗證身份。
所以問題是,我必須從JavaScript做Web表單身份驗證,如果是的話,如何?
此錯誤甚至與Web表單身份驗證相關,或者是狀態0可能完全不同。
我驗證了我可以從瀏覽器登錄後訪問該web服務。
這正是我一直在尋找的,而將Web服務保留在Webform保護之外對我們來說不起作用,第二個解決方案完美地工作。非常感謝你的幫助! – Eliseo