从mvc 5中的PartialViewResult操作方法访问时,会话为null

问题描述

我正在尝试使用PartialViewResult方法访问会话,但该会话变为空。实际上,我是从ajax获取请求中调用PartialViewResult。

        public PartialViewResult _UserActivitiesPartial(PramModel parmModel)
        {

                string DataBase = Session["DataBaseName"].ToString();
                //some code here
        }

在上述方法中,会话变为空。我正在从ajax调用调用上述方法

    function dateChange(start,end) {
    displayLoading(true);
    var parmsModel={StartDate:kendo.toString(start,"MM-dd-yyyy"),EndDate:kendo.toString(end,"MM-dd-yyyy")};
    $.ajax({
        type:'GET',url:'@Url.Action("_UserActivitiesPartial","Admin")',data:parmsModel,success: function (resDt) {
            displayLoading(false);
            $('#partialView').html(resDt);
        },error: function () {
            displayLoading(false);
        }
    });
}

在对该问题进行研究时,我尝试了一些反复试验的方法,但奇怪的是,当我进行更改时,它就起作用了

<customErrors mode="RemoteOnly"> 这个到 <customErrors mode="Off"> 在我的webconfig中。但这不是实际的解决方案。任何帮助都值得赞赏。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)