<%@ Application Language="C#"%> <%@ Import Namespace="System.Data"%> <script runat="server"> static Cache _cache; staticstring _path; void Application_Start(object sender, EventArgs e) { // Code that runs on application startup _cache = Context.Cache; _path = Server.MapPath("Stocks.xml"); DataSet ds =new DataSet(); ds.ReadXml(_path); _cache.Insert("Stocks", ds, new CacheDependency(_path), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Default, new CacheItemRemovedCallback(RefreshDataSet)); } staticvoid RefreshDataSet(string key, Object item, CacheItemRemovedReason reason) { DataSet ds =new DataSet(); ds.ReadXml(_path); _cache.Insert("Stocks", ds, new CacheDependency(_path), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Default, new CacheItemRemovedCallback(RefreshDataSet)); } void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown } void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs } void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started } void Session_End(object sender, EventArgs e) { // Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode // is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised. } </script>
posted on
2007-08-10 21:18simhare
阅读(365)
评论(0)
编辑收藏举报