上記のエラーがランダムに発生し、解決策を見つけることができませんでした。
//MyPage.aspx
//Reload Ajax function
$.fn.dataTableExt.oApi.fnReloadAjax = function (oSettings, sNewSource, fnCallback) {
if (typeof sNewSource != 'undefined') {
oSettings.sAjaxSource = sNewSource;
}
this.oApi._fnProcessingDisplay(oSettings, true);
var that = this;
oSettings.fnServerData(oSettings.sAjaxSource, null, function(json) {
/* Clear the old information from the table */
that.oApi._fnClearTable(oSettings);
/* Got the data - add it to the table */
for (var i = 0; i < json.aaData.length; i++) {
that.oApi._fnAddData(oSettings, json.aaData[i]);
}
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
that.fnDraw(that);
that.oApi._fnProcessingDisplay(oSettings, false);
/* Callback user function - for event handlers etc */
if (typeof fnCallback == 'function') {
fnCallback(oSettings);
}
});
};
//Timer
function AutoReload(){
CheckInfoDate();
setTimeout(function(){AutoReload();}, 50000);
}
function CheckInfoDate(){
$.ajax({
type: "POST",
url: "MyPage.aspx/CheckDate",
contentType: "application/json; chartset=utf-8",
dataType: "json",
success: function (data) { ProcessResult(data.d); },
error: function (orjRequest){ ErrorHandler(); }
});
}
function ErrorHandler() {
window.location.href = "../Login.aspx";
}
function ProcessResult(result) {
if (result != "False") {
RefreshDataTable();
}
}
function RefreshDataTable() {
table1.fnReloadAjax();
}
//MyPage.aspx.cs
[WebMethod(Description="Read Date from Database")]
public static String CheckDate()
{
//Basic SQL read from database and return as string
return DBCustomClass.CheckInfoDate().ToString();
}
私が受け取っているエラーログは次のとおりです。
ソース: http://localhost:8080/MyPage.aspx/CheckDate System.Web.HttpException: HTTP ヘッダーが送信された後にリダイレクトできません。
System.Web.HttpResponse.Redirect (文字列の URL、ブール値の endResponse)
で System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() で System.Web.HttpApplication.ExecuteStep (IExecutionStep ステップ、ブール値 & completedSynchronously)
どんな助けでも大歓迎です。