Last post Oct 12, 2009 05:08 PM by BanBeanO
Oct 12, 2009 10:25 AM|BanBeanO|LINK
I seem to have a problem in finding a solution to threads.
I am opening a .PDF file via an <iframe> using vb.net. Then the file is opened, it is then moved to another location. But for some reason I am unable to move the file because it "The process cannot access the file because it is being used by another process."
The only way round it i have found is to kill the process for Adobe Acrobat, so the file is released. Even if i fill the iframe with something else.
How would I close the file, and stop that particular file from being accessed before the move ?
Oct 12, 2009 12:40 PM|whighfield|LINK
What about moving it then opening it from the other location? Why the reason to move it? Security or something?
Oct 12, 2009 01:31 PM|BanBeanO|LINK
it is mainly a security issue, but also, the file is put in the wrong place, and needs sorting before its in it's final resting place. Good idea on moving it before they view it, but if they cancel half way through, i will still not be able to move it back
for sorting at a later stage? or can I ?
Thanks for your help in this.
Oct 12, 2009 01:35 PM|whighfield|LINK
and needs sorting before its in it's final resting place
Not sure what this means
but if they cancel half way through, i will still not be able to move it back for sorting at a later stage? or can I ?
Cancel what half way through?
Oct 12, 2009 01:58 PM|BanBeanO|LINK
they have to view in the <iframe> be before it is moved. If i move it before they sort it, which is a good idea, but cancel, go off page before they have finished sorting it, the file will be in the wrong place, and not added to the database, which would
i have to send it back to the holding dir so it can again be sorted.
I guess i could copy it to the new location, as the file name would not change, then delete the file in the old.... that will do it i think. I will have to test it out, because i am not sure if it later down the process it will again come up with the file
Thanks again, I will give it ago.
Oct 12, 2009 03:31 PM|atconway|LINK
Then the file is opened, it is then moved to another location. But for some reason I am unable to move the file because it "The process cannot access the file because it is being used by another process."
This makes sense that this is happening, and is by design. You are not
going to be able to move that file once opened and displayed in that iFrame for the user to view. Even ASP.NET aside, try to move a file (of any type) in Windows Explorer while it is open; you will not be able to do it.
Now you have a business rule that was stating the user must see it before it can be moved, because the ultimate location of the file is dependent on how the user sorts the file correct? If true, no matter what the logic you will have to close that file
before moving it.
Other options would be to only show the name of the file along with pertinent file information, rather than opening it so the user can still preform the necessary sorting or actions, and then move the file when complete. In this case the actual file was
If you can move it before hand to get the file in an optimal spot, and then
update the location based on user input, that may be a nice compromise. If the user closes the browser, then you still have the file saved off where you needed. One option to sort of 'lock' the screen so the user can not navigate away (could still close
browser, but prevents page clicks) would be to show the .pdf in a panel from an AJAX ModalPopupExtender that has .css to grey out the surrounding screen. I have done this as a nice altenative to pop up windows or iFrames IMO.
Two other possiblities are as follows:
These are just general suggestions since I do not have the full requirments of your situations. You may not need to implement anything fancy as mentioned above, and can just re-work the ordering of your logic. In any case, it is nice to have tools
like above in case you need them.
Oct 12, 2009 05:08 PM|BanBeanO|LINK
Hiya, and thank you, they are great suggestions which has made me think more of the end goal. I have googled how to close .PDF files, but with no resolve. I have tested it however, to see how it deals with opening more than one file, but in the task manager/processes
tab, you just get two instances of acrobat. If I kill the process, I may not get the right one, if they are view another PDF outside of this web application, or, i call them all, and they are left with no .PDF files open. I do find this part frustrating,
why can you not just close a file, like any other in system.OI using the .close attribute. This is not an option though when i have tried it on .PDFs. I would rather close the file.
Not easy. I also like the Ajax modpopup, I have used this, and its great, however, i still have the issue how to close the file. I will look at the APP from Ajax, that could be an option if the user closes the screen, if, when the file is copied to the
new location, it is removed, and the last line of code for the process would be to delete the old location. This would ensure if they close half way, it will also keep the old destination and APP can remove the one which has been copied to the new location.
Reading this back, it looks very confusing... More brandy maybe... or less..
Thanks again though, you have maybe me think quite a bit about a better solution.