asp.net开发WAP网站及集成在线wap模拟器(4)
现在我们要实现可以用于wap的page类了,WapPage.cs C# Code [http://www.xueit.com] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; us
现在我们要实现可以用于wap的page类了,WapPage.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.IO; // Author : Sonven // Blog : Sonven.cnblogs.com namespace Rsion.Web { public class WapPage:Page { public WapPage() : base() { } /// <summary> /// 绑定事件 /// </summary> protected override void BindEvents() { Page.Load = delegate(object s, EventArgs e) { HttpContext.Current.Response.Write("<?xml version="1.0"?> " "<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> "); }; Page.LoadComplete = delegate(object s, EventArgs e) { HttpContext.Current.Response.ContentType = "text/vnd.Web.wml"; }; //处理错误时候转向错误页面[仅在发布后] #if DEBUG #else Page.Error = delegate(object s, EventArgs e) { Session["errormsg"] = HttpContext.Current.Error.Message "<br />" "地址:" HttpContext.Current.Request.RawUrl.ToString(); HttpContext.Current.Response.Redirect("~/error.aspx"); }; #endif Page.PreRender = delegate(object s, EventArgs e) { }; } } }
这样就差不多只要继承WapPage就可以实现wap网页开发了
接下来我们创建模板,并给模板加上缓存提高性能
Application.cs用于提供缓存时间

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using Rsion.Web; namespace Rsion.Web { public abstract class Application:System.Web.HttpApplication { public static Template Template; /// <summary> /// 模板缓存时间 /// </summary> public static int TemplateCacheTime = 10; /// <summary> /// 重启Web进程 /// </summary> public static void RestartWebProcess() { HttpRuntime.UnloadAppDomain(); } } }
接下来我们创建一个单独的Template项目先
在里面创建Template.cs,ParamRules
精彩图集
精彩文章
热门标签
adb命令大全
gcc编译c
小球完全
图文安装
垃圾文件
设置壁纸
getline()
stripslashes
源到单一格
本地安卓
秘钥
dom4j解析xml文件
php php使用
报404错误
3元1次
数据库目录
slider
JS操作JSON
中文换行
fdisk
hex
ja
JS函数
反序列化
续传
行记录
sqlserve
js表格
创建链表
绑定类型
日志系统
ModelDriven
之堆
thinkphp控制器
android图片上传
指定类型文件
条形码生成器
中文长度
js调用
base标签
mp3下载
norflash接口
新浪
支持多少个线
目录配置
php php操作Exc
sql查询语句
无锁队列
php php代码
socket套接字
元组
数组最大值
当前时区
数据字典
java格式化数值
特定类别
des加密解密
有限状态机
mysql_field_
自动高亮
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229