/// <summary> /// 序列化viewstate对象 /// </summary> /// <param name="obj"></param> /// <returns></returns> private string SerializeObj(object obj) { string value = new ObjectStateFormatter().Serialize(obj); string stateID = (DateTime.Now.Ticks + (long)value.GetHashCode()).ToString(); //产生离散的id号码 File.WriteAllText(Path.Combine(Dir.FullName, stateID), value); Cache.Insert(stateID, value); return(stateID); }