FileIOPermission has nothing to do with the problem you are hitting; it refers to CAS-permissions which is a .NET only concept, and is used in partial trust environments such as Hosted ASP.NET.
There have been zero changes in this area for .NET 4.5, are you saying you are seeing a behavior change? These APIs delegate onto the underlying shell implementation; so most the behavior here would be inherited from the OS itself. From: [email protected] [mailto:[email protected]] On Behalf Of Ian Thomas Sent: Thursday, October 17, 2013 5:31 AM To: 'ozDotNet' Subject: RE: Problem with FileSystem.DeleteFile method in root directory Greg I will read your link, but just now I saw at the base of the FileSystem.Delete info, a link to the FileIOPermission Class. First, I need to unravel the digfferences between .NET 4.5 and all the earlier releases; I can see major changes. ________________________________ Ian Thomas Victoria Park, Western Australia From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Greg Keogh Sent: Thursday, October 17, 2013 8:25 PM To: ozDotNet Subject: Re: Problem with FileSystem.DeleteFile method in root directory Ian, years ago I remember seeing a Q&A about how to NOT send things into the recycle bin, and I vaguely recall it required a Win32 API call probably in shell32. If you can find that call and reverse the flag it might do what you want. Wait, it might be http://msdn.microsoft.com/en-us/library/windows/desktop/bb762164(v=vs.85).aspx, but I'm not certain. Greg On 17 October 2013 20:16, Ian Thomas <[email protected]<mailto:[email protected]>> wrote: This is situation is for a standard user on Windows 7. There is no such problem on pre-Vista Windows versions - and I assume the Windows 8 behaviour is similar to that on Windows 7. I want to use the Microsoft.VisualBasic assembly's FileSystem.Delete method universally, but can't work out how to get around the problem that the RecycleOption.SendToRecycleBin parameter is overridden once permission is given by the user to delete the file, when that file is in a restricted location like the root directory. My.Computer.FileSystem.DeleteFile(TestFilePath, FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException) If TestFilePath is "C:\test.file" then the usual security dialog occurs, and on continuing & giving permission the file is deleted - but permanently. On the otherhand, in a location like the user's desktop (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\Test.txt") it does get deleted to the recycle bin. How can I have the files always go to the recycle bin (assuming the user gives permission, as required)? ________________________________ Ian Thomas Victoria Park, Western Australia
