ASP.NET Session & Delete Folders

℡╲_俬逩灬. 提交于 2019-12-02 03:23:56
Pleun

Your session is lost becasue IIS recompiles. The easiest solution in my opinion is to store your files outside the wwwroot.

Discussed on SO: ASP.NET restarts when a folder is created, renamed or deleted

[Update] Example: Let's stay your app is in c:\inetpub\wwwoot\virtualdir1

You make a work directory: c:\inetpub\inetwork

Give the proper rights (read/write/etc) to the Asp.net user of your app pool and it should all work like a charm. More info on setting the rights: What are all the user accounts for IIS/ASP.NET and how do they differ?

Store the path to the workdirectory in your web.config (you no not want to hardcode it)

Having those files within the app folder is a poor desgin. The session is probably lost as you are causing IIS to recycle due to the file system changes. It is much safer to not have your web application able to write to its own folder, doing so is a security risk.

Separate your document folder and web site folder. And give right permission your document folder.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!