在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 程序中删除文件夹导致session失效问题的解决办法分享就介绍到这了。人远比自己想象的要,特别是当你回头看看的时候,你会发现自己走了一段自己都没想到的路。生活可以漂泊,可以,但灵魂必须有所归依。只要你地说出再见,生活一定会赐予你一个新的开始。更多相关ASP.NET 程序中删除文件夹导致session失效问题的解决办法分享内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!