设为首页 加入收藏 网站首页
休闲娱乐
军事·社会百态·娱乐八卦·校园
体育·美女写真·幽默笑话·游戏
综合·在线视频·搞笑图片·灵异
两性生活
两性知识·性爱技巧
情色实录·两性图片
女性健康·同性之恋
电脑网络
网络编程·网页制作·软件教学
操作系统·图形图象·冲浪宝典
网络安全·邮件系统·认证考试
热点专题
芙蓉·真人漫画
72式·欲望都市
帅哥·人体彩绘
您现在的位置: 世纪中国 >> 网络编程 >> ASP.NET教学 >> asp.net技巧 >> 教程正文
ASP.NET 2.0中的输出缓存
作者:中国图霸    教程来源:网络    点击数:    更新时间:2007-1-1
sed and can determine if you should be using a different key.

However, we are still not ensuring consistency of data type.

A Much Better Way - Using a Facade
Only access the HttpSessionState from within one single static class in your application - the facade. There must be no direct access to the Session property from within code on pages or controls, and no direct access to HttpContext.Current.Session other than from within the facade

All session variables will be exposed as properties of the facade class.

This has the same advantages as using a single class for all the session keys, plus the following advantages:

Strong typing of what gets put into session variables.
No need for casting in code where session variables are used.
All the benefits of property setters to validate what gets put into session variables (more than just type).
All the benefits of property getters when accessing session variables. For example, initialising a variable the first time it is accessed.
An Example Session Facade Class
Here is an example class to implement the Session facade for an application called MyApplication.

 Collapse
/// <summary>
///     MyApplicationSession provides a facade to the ASP.NET Session object.
///     All access to Session variables must be through this class.
/// </summary>
public static class MyApplicationSession
{
    # region Private Constants
    //---------------------------------------------------------------------
    private const string userAuthorisation = "UserAuthorisation";
    private const string teamManagementState =

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

分类推荐
社会 社会 娱乐 军事 校园
幽默 体育 女性 专题
电脑 编程 网页 软件 系统
安全 图象 冲浪 认证
搞笑 人物 动物 物品 表情
签名 色图 漫画 奇闻
美女 明星 清纯 自拍 欧美
丝袜 卡通 性感 走光
两性 知识 性图 孕育 技巧
同性 单身 情感 实录
视频 写真 搞笑 MTV 翻唱
写实 片段 游戏 综艺
asp.net技巧热门文章
普通教程 ASP.NET里常用的JS
普通教程 UpdatePanel与UrlRewrite
普通教程 .net内存回收与Dispose﹐Close
普通教程 用MasterPage 代替 PageBase
普通教程 DataSet 添加数据集、行、列、
普通教程 ASP.NET组件DataGrid的分页实用
普通教程 使用WebClient自动填写并提交A
普通教程 ASP.NET中水晶报表的使用
普通教程 对NDoc支持.net2.0的异常分析及
普通教程 关于ASP.NET调用javascrip
普通教程 MSBuild, NAnt, NUnit, MSTest
普通教程 asp.net 2.0 上传控件的使用
普通教程 UpdatePanel和自定义控件中的客
普通教程 ASP.NET—From验证:全部代码及
普通教程 自己写的一个asp.net的生成曲线
普通教程 js操作listbox
普通教程 ASP.NET 崩溃-SiteMap中疯狂的
普通教程 ASP.NET 2.0-选用DataSet或Da
普通教程 用.net 处理xmlHttp发送异步请
普通教程 ASP.Net 2.0 图形控件简述

  广东广州海珠区 世纪网络工作室 版权所有 上海电信提供网络带宽
信箱: 9297659@qq.com 粤ICP备06113754号