
Asp.net中的HttpModule和HttpHandler的简单用法
发布日期:2021-05-14 04:37:14
浏览次数:16
分类:博客文章
本文共 1969 字,大约阅读时间需要 6 分钟。
���Asp.net������HttpModule���HttpHandler���������������IIS������������������������������������������������������������������������������������������������������������������������������������
������������HttpModule������������������������������������
using System; using System.Web; namespace MyWebApp { public class MyHttpModule:IHttpModule { public void Init(HttpApplication application) { application.BeginRequest+=new EventHandler(application_BeginRequest); } public void application_BeginRequest(object sender, EventArgs e) { HttpContext context = (sender as HttpApplication).Context; context.Response.Write("������������������HttpModule���������"); } #region IHttpModule ������ void IHttpModule.Dispose() { throw new NotImplementedException(); } #endregion } }
���������������������������HttpModule������������������������IHttpModule���������������������������Dispose���������������������������������������������������������web.config������������������������������������������
���������HttpHandler���������������������IHttpHandler���������������������������web.config������������������
using System.Web; using System.Web.Services; namespace MyWebApp { ////// $codebehindclassname$ ��������������� /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class MyHttpHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("������������������HttpHandler������!"); } public bool IsReusable { get { return false; } } } }
���web.config���������������������
���������������������
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2025年04月18日 04时25分23秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
可变长度参数
2021-05-14
堆空间常用参数总结
2021-05-14
逃逸分析-堆分配对象
2021-05-14
常量池、运行时常量池
2021-05-14
3、条件查询
2021-05-14
5、分组函数 / 聚合函数
2021-05-14
8、子查询
2021-05-14
cordova打包apk更改图标
2021-05-14
开启与配置SMTP服务器
2021-05-14
域名解析步骤
2021-05-14
APP卡片式设计
2021-05-14
GitHub上传时,项目在已有文档时直接push出现错误解决方案
2021-05-14
云数据库
2021-05-14
大数据在不同领域的应用
2021-05-14
页面置换算法
2021-05-14
推荐系统资料
2021-05-14
文件系统的层次结构
2021-05-14
减少磁盘延迟时间的方法
2021-05-14
vue(渐进式前端框架)
2021-05-14
权值初始化和与损失函数
2021-05-14