您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> asp >> 正文

ASP+ 学习笔记 4

作者:佚名    信息学院来源:整理    点击数:    更新时间:2008-1-24 我要参与讨论

  > String _storeFile="mystore";
ArrayList values=new ArrayList();
IsolatedStorageFileStream stream = null;
try{
stream = new IsolatedStorageFileStream(_storeFile,FileMode.Open);
}catch(Exception e){}
if(null!=stream){
values=(ArrayList)BinarySerializer.DeSerialize(stream);
stream.Close();
}

//保存数据
IsolatedStorageFileStream stream;
stream = new IsolatedStorageFileStream(_stroeFile,FileMode.OpenOrCreate);
ArrayList values = new ArrayList();
values.Add("test1");
......
BinarySerializer.Serializer(values,stream);
stream.Close();

使用上例时注意需要引入名称空间:
System.IO;
System.IO.IsolatedStorage;
System.Runtime.Serialization.Formatters;

6).离线数据同步
现在这个版本的myweb还不支持自动地实现同步。
可以用myweb.Connected属性判断当前是否连在网上。


六、Cache服务

Caching动态产生的内容叫output catching。
Caching专门的对象叫Data Catching。
asp+中提供了专门的Cache引擎。

1).output caching
设置response的expiration/validation,仅对GET和HEAD有效,支持URL中的参数,完全相同
时使用catching中的内容。内容缺省地将在cache中保存60分钟。
要让一个.aspx文件被caching,仅需要加一行:
<%@ OutputCache Duration="60" %>
上面的60指60秒。
要实现更多的控制,如下:
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
或者:
SetExpires(DateTime.Now.AddSeconds(60));
SetCacheability(HttpCacheability.Public);
SetSlidingExpiration(true);

2).Data Caching
Cache引擎可以让你把对象保存到其中,只有应用重启后才需要重建Cache。是一个字典接口,如:
Ca

上一页  [1] [2] [3] [4] 下一页

在google里搜索更多ASP+ 学习笔记 4

Google
Web www.51ec.org
  • 上一篇信息学院:

  • 下一篇信息学院:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    我来说两句 对此文章发表了评论
      昵 称: *必填    ·注册用户·
      评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
    评 论
    内 容

     
    评论列表 (最新 评论仅限网友观点!)

    供求信息




    | 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明