会话变量从Jquery对话框代码执行Url.action调用时丢失

会话变量从Jquery对话框代码执行Url.action调用时丢失,jquery,asp.net,asp.net-mvc,jquery-ui,session,Jquery,Asp.net,Asp.net Mvc,Jquery Ui,Session,在Win7 x64上运行VS 2013的IE10中,我遇到了一个非常奇怪的问题 当我在“internet选项”中单击“确定”时,会话将在请求上持续!当我重建应用程序时,它会断开。在“internet选项”中再次单击“确定”将使其恢复工作状态,直到重建并继续 到目前为止,我有: -将IE设置为检查存储页面的更新版本:每次访问页面时 -使用开发工具清除缓存 -检查每个项目的目标都是相同的.NET framework,它们是完整版本,而不是客户端配置文件。 -已使用此代码停止应用程序缓存 protec

在Win7 x64上运行VS 2013的IE10中,我遇到了一个非常奇怪的问题

当我在“internet选项”中单击“确定”时,会话将在请求上持续!当我重建应用程序时,它会断开。在“internet选项”中再次单击“确定”将使其恢复工作状态,直到重建并继续

到目前为止,我有:
-将IE设置为检查存储页面的更新版本:每次访问页面时
-使用开发工具清除缓存
-检查每个项目的目标都是相同的.NET framework,它们是完整版本,而不是客户端配置文件。
-已使用此代码停止应用程序缓存

protected void Application_BeginRequest()
{
    //Used for disabling page caching
    HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
    HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    HttpContext.Current.Response.Cache.SetNoStore();
}
会话变量正在使用我在第行找到的以下代码进行设置和检索

public class SessionManager
{
    //Session variable constants
    public const string DATEFORMATVAR = "DisplayDateFormat";

    //use generics to work with any type
    public static T Read<T>(string variable)
    {
        object value = HttpContext.Current.Session[variable];
        if (value == null)
            return default(T);
        else
            return ((T)value);
    }

    public static void Write(string variable, object value)
    {
        HttpContext.Current.Session[variable] = value;
    }

    public static string DisplayDateFormat
    {
        get
        {
            return Read<string>(DATEFORMATVAR);
        }
        set
        {
            Write(DATEFORMATVAR, value);
        }
    }

有人知道这是什么原因吗?

您使用的是无cookie会话吗?Wize-没有,cookie没有被禁用。我把它隔离得更远一点,排除了url.action。此代码$(This.load(“/Customer/CustNotesSearchJqDia”);也会丢失会话-看起来我对jquery对话框丢失会话有问题!谢谢你的回复-有什么想法吗?
        //jQuery Customer Selection from Customer Notes page
        $("#cn-btn-cust-slt").button().click(function () {
            $("#cn-dialog").dialog({
                autoOpen: true,
                position: { my: "left", at: "top+350", of: window },
                width: 700,
                height: 600,
                resizable: false,
                title: 'Customer Selection',
                modal: true,
                open: function () {
                    $(this).load('@Url.Action("CustNotesSearchJqDia", "Customer")');
                },
                buttons: {
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                }
            });
        });