ASP.NET Session & Delete Folders

后端 未结 3 482
别那么骄傲
别那么骄傲 2021-01-25 01:09

I have a web app where the administrator can create news, pdf documents and other stuff in his cms panel.

The problem is when the admin delete a new or something else th

相关标签:
3条回答
  • 2021-01-25 01:44

    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)

    0 讨论(0)
  • 2021-01-25 01:47

    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.

    0 讨论(0)
  • 2021-01-25 01:58

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

    0 讨论(0)
提交回复
热议问题