在Global中  application_Start 添加

如:

复制代码 代码如下:

void Application_Start(object sender, EventArgs e)
    {
        //在应用程序启动时运行的代码
        System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty(“FileChangesMonitor”, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
        object o = p.GetValue(null, null);
        System.Reflection.FieldInfo f = o.GetType().GetField(“_dirMonSubdirs”, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase);
        object monitor = f.GetValue(o);
        System.Reflection.MethodInfo m = monitor.GetType().GetMethod(“StopMonitoring”, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
        m.Invoke(monitor, new object[] { });
    }

您可能感兴趣的文章:

  • asp.net 删除项目文件/文件夹IIS重启,Session丢失问题
  • asp.net基于session实现购物车的方法
  • 实现Asp与Asp.Net共享Session的方法
  • ASP.NET 使用application与session对象写的简单聊天室程序
  • ASP.NET ASHX中获得Session的方法
  • ASP.NET中在一般处理程序中使用session的简单介绍
  • Asp.Net程序目录下文件夹或文件操作导致Session失效的解决方案
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。