参数值间歇地传递给控制器​​时变为NULL

时间:2018-08-02 14:17:06

标签: jquery .net ajax asp.net-mvc wcf

我们正在使用MVC.net框架,并使用jQuery和Ajax将数据从视图传递到控制器。

这是负责发送请求的JavaScript代码段

var obj = {
    Post: function (actionUrl, aParam, showLoading, async, retry) {
                var result;
                aParam = typeof aParam === "undefined" || aParam === null ? '' : aParam; //check for undefined
                async = typeof async === "undefined" || async === null ? true : async; //check for undefined

                var result;
                return $.ajax({
                    url: actionUrl,
                    data: aParam,
                    async: async,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    beforeSend: function () {
                        if (showLoading) {
                            dialogCounter++;
                            Common.Ui.showLoading();
                        }
                    },
                    complete: function () {
                        if (showLoading) {
                            dialogCounter--;
                            if (dialogCounter <= 0)
                                Common.Ui.hideLoading();
                        }
                    },
                    type: 'POST'
                }).error(function (error) {
                    if (retry && errorCounter < 3) {
                        errorCounter = errorCounter + 1;
                        Core.Ajax.Post(actionUrl, aParam, showLoading, async, retry);

                    }
                    else {
                        errorCounter = 0;
                        Core.Ajax._AjaxError();
                    }
                });

                   // .error(Core.Ajax._AjaxError);
            }
}

这是导致问题的控制器中的动作。它以对象作为参数。

[HttpPost]
    public ActionResult SaveOrder(Order Order, OrderAddress shipToAddress, OrderAddress consultantAddress, OrderAddress installationAddress, String Notes, String NotesId)
    { ....
  • 我们的SessionState已禁用
  • 我们正在使用SOAP / REST WCF的组合

该问题间歇性地发生,如果再次调用ajax请求,则该问题消失了。

0 个答案:

没有答案
相关问题