Session中存复杂对象

                            if (System.Web.HttpContext.Current.Session["PersonalPagesize"] != null)
                            {
                                PersonalPagesize = (Dictionary<string, Dictionary<string, string>>)System.Web.HttpContext.Current.Session   ["PersonalPagesize"];
                                if (PersonalPagesize.ContainsKey(userName))
                                {
                                    Dictionary<string, string> PagesizeOfEachQuery = PersonalPagesize[userName];
                                    if (PagesizeOfEachQuery.ContainsKey(htmlWin.QueryID))
                                    {
                                        PersonalPagesize[userName][htmlWin.QueryID] = this.pagesize;
                                    }
                                    else
                                    {
                                        PersonalPagesize[userName].Add(htmlWin.QueryID, this.pagesize);
                                    }
                                }
                                else
                                {
                                    Dictionary<string, string> PagesizeOfEachQuery = new Dictionary<string, string>();
                                    PagesizeOfEachQuery.Add(htmlWin.QueryID, this.pagesize);
                                    PersonalPagesize.Add(userName, PagesizeOfEachQuery);
                                }
                            }
                            else
                            {
                                Dictionary<string, string> PagesizeOfEachQuery = new Dictionary<string, string>();
                                PagesizeOfEachQuery.Add(htmlWin.QueryID, this.pagesize);
                                PersonalPagesize.Add(userName, PagesizeOfEachQuery);
                            }
                            System.Web.HttpContext.Current.Session["PersonalPagesize"] = PersonalPagesize;

你可能感兴趣的:(session)