ASP.NET丢失会话数据时web应用删除目录 [英] ASP.NET loses session data when delete directory on WebApplications

查看:182
本文介绍了ASP.NET丢失会话数据时web应用删除目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的asp.net MVC2 Web应用程序和我有在我认为是在web应用默认的行为,一个有趣的情况有点问题。 (=的sessionState INPROC)

I'm creating a web application in asp.net mvc2 and I'm having a little problem in an interesting situation that I assume is a default behaviour on webapplications. (sessionstate= inproc)

当我删除web应用根目录中的目录,我的会话数据被清除。

我从人民要求的解决方案看了一些问题,但没有太多关于这个问题,有没有人知道如何prevent这种行为?

I've read some questions from people asking for a solution, but not much about the problem, does anyone know how to prevent this behaviour?

注意:我不想动目录等子域由IIS的其他实例服务,并且不希望更改SQLSERVER的sessionState

Note: I don't want to move directory for other "subdomain" served by other instance of IIS, and don't want to change sessionstate for sqlserver

在此先感谢您的帮助。

谢谢你们,在什么地方找到该套件在那篇文章的链接。

THANKS GUYS, FOUND THE SOLUTION SOMEWHERE ON A LINK OF THAT ARTICLE.

我已经在我的Global.asax中添加的Application_Start如下因素code:

i've added on my global.asax Application_Start the folowing code:

Dim p As System.Reflection.PropertyInfo = GetType(HttpRuntime).GetProperty("FileChangesMonitor", Reflection.BindingFlags.Public Or Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Static)
Dim o As Object = p.GetValue(Nothing, Nothing)
Dim f As System.Reflection.FieldInfo = o.GetType.GetField("_dirMonSubdirs", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.IgnoreCase)
Dim monitor As Object = f.GetValue(o)
Dim m As System.Reflection.MethodInfo = monitor.GetType.GetMethod("StopMonitoring", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)
m.Invoke(monitor, New Object() {})

的感谢。

<一个href=\"http://dotnetslackers.com/Community/blogs/haissam/archive/2008/11/12/disable-session-expiration-when-using-directory-delete.aspx\" rel=\"nofollow\">http://dotnetslackers.com/Community/blogs/haissam/archive/2008/11/12/disable-session-expiration-when-using-directory-delete.aspx

推荐答案

最有可能涉及到这一块:<一href=\"http://stackoverflow.com/questions/502743/asp-net-deleting-a-directory-results-in-application-restart\">ASP.NET在删除应用程序重新启动目录的结果。

Most likely relates to this one: ASP.NET Deleting a directory results in application restart.

这个博客帖子可能会澄清事情有点给你:删除目录在ASP.net 2.0

this blog post might clarify things a bit for you: Deleting Directory in ASP.net 2.0

我的建议是建立一个虚拟目录和操作目录中的内容(而非触摸的应用程序目录本身)。

My suggestion would be to create a virtual directory and manipulate the contents of that directory (instead of touching app directory itself).

这篇关于ASP.NET丢失会话数据时web应用删除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆