文件操作 string path = @"e:\MyTest.txt"; DateTime dt = DateTime.Now; if (!File.Exists(path)) } web應用中的Cache操作 Cache cache = System.Web.HttpContext.Current.Cache;string obj=null;cache.Insert("cache1",obj,null,DateTime.Now.AddHours(1),TimeSpan.Zero,CacheItemPriority.AboveNormal,null); 當然對於簡單的字符串,使用以下方式即可 Application["Title"] = "Test Sample"; cache操作可以放在任何地方,當然放在Global.asax的Application_Start(Object sender, EventArgs e)中最好. 相关文章: 2021-09-09 2022-12-23 2021-05-19 2021-11-03 2021-10-31 2021-08-07 2021-12-07