Hi everyone.
i have to create a file with the payment's transactions of many clients that will be uploaded to a bank, and in case of an error delete the file.
i've done some investigation to achieve ths porpuse and after setting the TextIo Object that modifies the file is set to null, and ask for the necessary permissions,(which are granted.) i check the the filename status(WinApi::statusblocked) and it keeps true so doesn't let me delete the file throwing a ClrObject error.
am i doing somiething wrong? is there another way to unlock the file for edition?
mi code is the next, both methods are from a VendOutPaym Derived Class
GeneratePaymentsLines:
//some stuffs
if(error)
{
file = null;
VendOutPaymDerivedClass::Deletefile(filename);
throw error(@"")
FileIoPermission FileIoPermission;
//more stuffs
deleteFile:
static client void deleteFile(Filename _filename)
{
FileIoPermission FileIoPermission;
try
{
FileIoPermission = new set(Types::Class);
FileIoPermission.add(new InteropPermission(interopKind::ClrInterop));
FileIoPermission.add(new fileIOPermission(_filename,'rw'));
codeAccessPermission::assertMultiple(FileIoPermission);
print(WinApi::fileLocked(_filename));
WinApi::deleteFile(_filename);
info('file was not maked');
}
catch
{
warning('incomplete file');
}
}
i override the deletemethod to make sure the delete run on client's side, since "filename" was a server variable on generatepaymentlines method, hopying it would help but the filename status still es blocked
hope i made myself clear.