Environment.CurrentDirectory and Multiple Page Requests
-
I'm using ASP.NET 4.0 working in VS2010 right now only debugging not moved to a real server. I have some code to set the working directory node by node. This handles paths longer than the limit.
string[] dirs = targetDirectory.Split(Path.DirectorySeparatorChar);
foreach (string dir in dirs)
{
string adir = "." + Path.DirectorySeparatorChar + dir;
if (!Directory.Exists(adir))
{
Directory.CreateDirectory(adir);
}
Environment.CurrentDirectory = adir;
}I'm seeing that when handling multiple requests the one request will write the cwd and the other request wil try to write too and they end up conflicting. I'm not really surprised. This does totally foil my plans for world domination. Can anyone suggest something? Locking an object until I begin file operations? Is there a setting in IIS to make separate processes? I really could use some help with this one.