如何自定义IHttpHandler
轉載:http://dev.mjxy.cn/a-How-to-customize-the-IHttpHandler.aspx
定義處理HttpHandler 讓ModuleX加載的時候稍有延遲。
?public class DelayDownloadHandler :IHttpHandler
??? {
??????? public bool IsReusable
??????? {
??????????? get { return true; }
??????? }
??????? public void ProcessRequest(HttpContext context)
??????? {
??????????? string path = context.Server.MapPath(context.Request.Path);
??????????? if (context.Request.Path.Contains("ModuleZ"))
??????????? {
??????????????? Thread.Sleep(3000);
??????????? }
??????????? context.Response.WriteFile(path);
??????? }
??? }
配置web.config 在httphandler節增加配置
?? <httpHandlers>
??????? <add verb="*" path="*.xap" type="RemoteModuleLoading.Web.DelayDownloadHandler, RemoteModuleLoading.Web"/>
?? </httpHandlers>
type=Namespace.Class,AssemblyFile
轉載于:https://www.cnblogs.com/xingquan/archive/2011/07/14/2105938.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的如何自定义IHttpHandler的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于拖拽上传 [一个拖拽上传修改头像的流
- 下一篇: 如何提高意志力