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
精彩图集
精彩文章
热门标签
mysql自动备份
dll生成lib
connections
nginx
相册
3D扇形
捕获
双括号
SQLAlchemy
虚继承
验证用户名
os模块
bg
is
创建Web服务
屏蔽HOME键
data-*
Twitter
页面显示
华为
dbi
overload
城市判断
过滤选择器
Oracle用户解锁
边
连续获取
基础 无域
updatepanel用
js获取属性
readfile
解
构造icmp
逐行读取
水平滚动
读写分离
getopt模块
PHPThumb
自动调节
移除tr
音效
简介
排序数组
WinExec
大容量数据
sql数据库连接
脚本全局
charset
不用图片
mbstring扩展
php变量作用域
logcat命令
线程并发
横向报表
JS获取URL
目标函数
主框架
主分区
并发插入优化
PHP ddos
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229