我有這種情況,當我從global.asax文件數據持久存儲數據時,必須將數據存儲在應用程序變量中。 如果我寫的應用程序變量中的商店數據相同的代碼從任何aspx頁面數據丟失一段時間後,我想知道爲什麼發生了,請在下面建議是我的代碼?爲什麼應用程序變量數據在一段時間後丟失
//storing data in application variable from aspx page
protected void getApplicatinVariable_Click(object sender, EventArgs e)
{
HttpContext.Current.Application[paramTypeId] = GetSelectedParameter(paramTypeId, flag);//fuction retruning string data
HttpContext.Current.ApplicationApplication["GroupUserListCache"] = CacheClass.GetGroupUserListCache();//get userlist
HttpContext.Current.ApplicationApplication["EquipListCache"] = CacheClass.GetAlarmEquipListCache();
}
//from global.asax file in dis case data persist.
Application[paramTypeId] = CacheClass.GetSelectedParameter(paramTypeId, "");
Application["GroupUserListCache"] = CacheClass.GetGroupUserListCache();//get userlist
Application["EquipListCache"] = CacheClass.GetAlarmEquipListCache();//CacheClass.SetEquipment();
你能鏈接你的報價來源嗎? – user1666620
爲您添加了鏈接 –
已同意,但我在本地計算機上託管了此應用程序,並且只有一個應用程序託管在那裏。所以沒有網絡農場或網絡花園的機會,我正在我的局域網中測試它。仍然在一段時間後失去。 –