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
C# Code [http://www.xueit.com]
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用于提供缓存时间
C# Code [http://www.xueit.com]
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
精彩图集
精彩文章
热门标签
移动网络数据
元素拖动
新浪微博api
Linux用户管理
nowdoc
logging
date命令
mysql字符串
相同后缀
国家气象局
无环图
高级编程
枚举
当前
CD-KEY
拿来
配置jdk
开发工具
层次查询
未读
大小写敏感
R3
java反序列化
空行
分割文件
PHP分词
保护硬盘
拼合生成器
统计总行数
创建视图
windows误删
php 将字
游戏
透明窗体
聊天命令
self
android网络编程
照片伸缩
文件大小
excel生成报表
UbuntuSamba
触发表
二进制流
HTML表单
语法特性
超实
Prim算法
导航问题
NGEN
两行字符
AjaxFileUplo
XHTML
运行机制
前导0
setInterval
标签
301
D3.js
另一
Mempodipper本
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229

