I have a web app. When I create a client I upload some pictures in that process to a temp folder I create using the Ticks. Finally, when the client in created I move that folder to the main folder of clients pictures whith the name of the client Id I just get.
DirectoryInfo dirTemp = new DirectoryInfo(String.Concat(sPath, "temp/", sTicks));
dirTemp.MoveTo(String.Concat(sPath, sName));
My folders structure is this:
sPath = "~/Files/Clients/"
The problem is I’m losing the Session everytime I move the folder…
Any time you move/delete/add a directory in your appDomain – your current session will be destroyed.
Try to move a directory that is not within your application folders – that should do the trick! If this is no proper solution for your problem change your sessionState mode. Currently, I assume, it is InProc. Change it to StateServer or SQLServer.
(see also Forums ASP)
Furthermore – possible duplicate? – see this post