Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File.Exists(string path) misbehavior
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows 2000
Miscellaneous
Thread ID:
01009851
Message ID:
01010556
Views:
25
Einar,

My network admin told me that we are dumping Novell for Windows networking, so Novell will no longer be a variable. After we are on Windows, I will see if the problem remains. (My vote is for automagic disappearance.)

My software only allows filenames to be entered into the database if they have already been copied where the program expects them to be, so the case in which a file doesn't exist should never happen. I think that I will just check in on the program from time to time to babysit it until we switch to Windows networking.

I am going to search online for more info about impersonation, Novell, and .NET and see what treasure trove of info is available. If I find anything useful, I will post back here.

Thanks for your help.

David

>David,
>That is very strange. What I would do is create a new solupion with one button that has the code from your original post in it (but instead of copying just have a messagebox that states if the file was found or not). That way you can rule out any other factors, and find out if it is Novell that is causing this.
>
>So you impersonate a different user, hmm does the impersonated user have rights to the file? (I am sure you checked that) If not I am sure it would appear that the file doesn't exist for that user.
>
>I don't think you can destroy a static object without unloeading the assembly.
>
>If you post your code I will take a look at it, but it would be interesting to hear from someone else running Novell. How well does impersonation work with Novell?
>
>Einar
>
>>Einar,
>>
>>Thanks for taking the time to look at this.
>>
>>I can run it all day without problems, so long as the files are all actually where they are supposed to be. I have checked for silly mistakes. If I run it for 5 files, it works fine. If I run it again on the same 5 files and remove the third file, the first two are copied, the third one doesn't exist and isn't copied, but then the fourth and fifth ones are reported as non-existent.
>>
>>I hate to add an additional ugly detail, but this code is part of a Windows service and the code below occurs inside an impersonation context. I really didn't want that to matter, but maybe I should mention it in case it does. The impersonation context is wrapped around the file transfer only.
>>
>>If the service is restarted after one file is reported non-existent, it does not mistakenly report existent files as not existing. I wonder if, somehow, the static File object is getting stuck and if I could force .NET to destroy the File object and recreate it every time a file didn't exist, that would be a decent workaround.
>>
>>Can I force the destruction of a static object by calling the destructor, somehow?
David S. Alexander
Kettley Publishing
20271 SW Birch Street, 2nd Floor
Newport Beach, CA 92660-1752
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform