ASP.NET 程序中删除文件夹导致session失效问题的解决办法分享
在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[] { });
}
上一篇: Java String对象使用方法详解
下一篇: 实例解析JAVA中代码的加载顺序