using System;
using System.Web;
using Microsoft.Web.Infrastructure;

namespace MvcApplication1
{
    public class CustomModule : IHttpModule
    {
        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }

        void context_BeginRequest(object sender, EventArgs e)
        {
            HttpApplication ap = sender as HttpApplication;
            if (ap != null)
            {
                ap.Response.Write("汤姆大叔测试PreApplicationStartMethod通过!<br/>");
            }
        }

        public void Dispose()
        {
            //nothing to do here
        }
    }

    public class PreApplicationStartCode
    {
        private static bool hasLoaded;

        public static void PreStart()
        {
            if (!hasLoaded)
            {
                hasLoaded = true;
                //注意这里的动态注册,此静态方法在Microsoft.Web.Infrastructure.DynamicModuleHelper
                Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(CustomModule));
            }
        }
    }
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MvcApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MvcApplication1")]
[assembly: AssemblyCopyright("Copyright ©  2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98a0cfd0-fae7-43dd-8626-b49f8df939be")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: System.Web.PreApplicationStartMethod(typeof(MvcApplication1.PreApplicationStartCode), "PreStart")]

最新文章

  1. ABP源码分析三十八: ABP.Web.Api.OData
  2. OC基础--Xcode 模板修改和文档安装
  3. IDE-Sublime【1】-JsFormat插件格式化缩进问题
  4. 如何让我们的VMware虚拟机上网——转载
  5. [转]GridView排序——微软提供Sort
  6. new Date()时间对象
  7. uva 11020 - Efficient Solutions ——平衡BST
  8. bzoj 3489: A simple rmq problem k-d树思想大暴力
  9. 关于弹出层(iframe)时刷新页面的js
  10. Top 10 Books For Advanced Level Java Developers
  11. 编写原生JS的insertAfter函数
  12. ORA-00257: archiver error. Connect internal only, until freed.| Oracle数据库归档日志满导致应用系统反应缓慢的问题处理
  13. 学习 ASP.NET Core 2.1:集成测试中使用 WebApplicationFactory
  14. better-scroll使用总结
  15. PyQt5 的几个核心模块作用
  16. PWA 入门: 写个非常简单的 PWA 页面
  17. FunDA(7)- Reactive Streams to fs2 Pull Streams
  18. Django实现支付宝支付(沙箱)
  19. webgote的例子 数据库与sql注入的相关联系(1)
  20. ORA-**,oracle 12c操作问题

热门文章

  1. xml保存基本信息
  2. js声明json数据,打印json数据,遍历json数据
  3. App.Config详解及读写操作
  4. Spring Test+JUnit整合使用
  5. Entity Framework 学习笔记
  6. dbms_output.put_line 不显示
  7. 线程,yield让出cpu调度
  8. pip China
  9. Struts2:效验器——注解
  10. 使用Struts2搭建登录注册示例