从ASP.NET应用程序返回到新会删除目录 [英] Delete Directory from ASP.NET application returns to new session

查看:107
本文介绍了从ASP.NET应用程序返回到新会删除目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从ASP.NET应用程序中删除目录。缺失变细,但是当我从之前删除丢失回到我所有的会话数据。

不要紧,我是否使用:

I'm deleting a directory from within an ASP.NET application. The deletion goes fine, but when I return from it all my session data from before the delete is lost.
It doesn't matter whether I use:

                if (Directory.Exists(folderPath))
                    Directory.Delete(folderPath, true);

或者

                System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(folderPath);
                if (d.Exists)
                    d.Delete(true);

在这两种情况下,我失去了我的会话数据。

In both cases I lose my session data.

有没有人碰到这个问题?

Has anyone run into this problem?

推荐答案

如果您要删除应用程序中的一个子目录,你的应用程序域将重新启动。这将删除所有的会话数据。为了缓解这一问题,只能添加/删除目录之外的应用程序的主目录。

If you are deleting a subdirectory within your application, your app domain will restart. This removes all session data. To alleviate this issue, only add/remove directories outside your application home directory.

这篇关于从ASP.NET应用程序返回到新会删除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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