欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Deleting Directory in ASP.net 2.0

系統(tǒng) 2276 0

http://www.vikramlakhotia.com/Deleting_Directory_in_ASPnet_20.aspx

Have you tried to delete a directory programmatically in ASP.Net 2.0? Don’t try it; it can cause great problems to your site especially if you are using in-proc session. You will lose the entire session variable after deleting the directory and there is no way of getting those session variable back. This system is a change from asp.net 1.X.

I came to know about this the hard way. I was working on a project were project submission was a process of 6 pages (All in one page using the MultiView control). In the last stem I was supposed to delete the entire directory which was created during the process. Strangely I was loosing all the session values when the directories were deleted.

The problem gets bigger from the fact that the AppDomain will restart again on the first request to that application. So there is no way to restore the session after deleting the directory in the application domain. There is no problem in creating the directory but deleting will hurt the in-proc session.

What we can do not delete the folder and only delete the files in the folder. I.e. instead of

Directory.Delete(Server.MapPath(path), true);

Use

filedelete(Server.MapPath(path));

where filedelete() is, (I prefer creating these utilities into function so that I do not write the same code again and again)

private void filedelete(string path)
{
??? ??? string[] st;
??????? st = Directory.GetFiles(path);
??????? int i;
??????? for (i = 0; i < st.Length; i++)
??????? {
??????????? try
??????????? {
??????????????? File.Delete(st.GetValue(i).ToString());
??????????? }
??????????? catch { }
??????? }
? ? }

I never thought this File Change Notifications (FCN) can cause me so much of problem. So if you find yourself working with file system in DOT Net. Remember deleting a directory can be more than dangerous. So try not to delete any directory at the runtime.

Deleting Directory in ASP.net 2.0


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 日韩日b视频 | 久久国产精品视频 | 国产欧美精品亚洲桃花岛 | 国产精品69久久久久水密桃 | 成年视频在线观看免费 | 欧美色专区 | 精品一区二区三区视频 | 大伊香蕉精品视频在线天堂 | 国产一区二区三区免费观看 | 狠狠视频 | 五月天婷婷基地 | 狠狠的撸2015最新版狠狠的撸2015最新版 | 日韩一区二区三区精品 | 中文字幕无线码一区二区三区 | 日韩在线不卡一区 | 三级视频网站 | 色精品国产 | 亚洲 欧美 中文字幕 | 高清不卡一区二区 | 日韩精品www | 精品网站999| 欧美一区二区 | 五月激情六月 | 欧美特级黄色 | 一区二区三区四区在线 | 亚洲高清国产拍精品影院 | 午夜天堂精品久久久久 | 中文字幕一区二区三区四区五区 | 日韩电影第一页 | 国产在线一区二区三区 | 人人爽久久涩噜噜噜蜜桃 | 一区二区高清 | 精品国产免费一区二区三区 | 精品久久99 | 成人福利在线免费观看 | 国产成人小视频在线观看 | 午夜剧场在线免费观看 | 久久久综合 | 免费黄色电影在线观看 | 99久久精品免费 | 2021国产精品成人免费视频 |