File.Copy Method timing issues.

  • Thread starter Thread starter Brian Hanson
  • Start date Start date
B

Brian Hanson

Hi,

I have a problem that is sporadic and am thinking it may come down to
a timing issue. I have an asp.net (vb) app that used the
system.io.file.copy method to copy a .pdf file from a network drive to
the local server drive. From there I use that .pdf file to create
another .pdf file using a tool from ActivePDF. The problem I have is
that one out of 8 or 10 times I get an error:

Access to the path "c:\ActivePDF\watever.pdf" is denied.

This is the file I just copied from the network and am trying to use
for something else.

If I try it again, it usually works right away. Since it usually
works, I can eliminate any permission issues, and wonder if it is a
timing issue.
I thought that the file.copy method was synchronous so it will finish
its copy before moving on to the next bit of code. I then looked at
the indexing features of the folder the file was being copied to and
made sure that indexing was turned off. I have not, however,
eliminated ActivePDF from being the problem child.

Thanks for any ideas.
 
Hi,


Thanks for posting in the community!
From your description, you used the System.IO.File.Copy method to copy a
file from a remote address and then use it in an ASP.NET web application.
However, you found that sometimes there occured Access Denied error at
runtime. Also, you suspect it was caused by time issue, yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, access resource on remote site will often caused
security issues. But since you've mentioned that the error is after file's
been copied to local and it works well usually. I also doubt whether it is
caused by
concurrency issue on the copied file. Would you please try the following
steps:
1. copying file from a local different folder rather than a network driver
to see whether the problem remains. then, we can confirm whether this is
likely caused by the time issue or not.

2. Also , you can try accessing(read) the file after it has been copied(in
a try... catch ...block) so as to determined whether it is concurrent
visited or completely copied.

Please check out the above things, if the situation is not quite suitable,
please feel free to let me know.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi,


Have you had a chance to try out the preceding suggestions I provided in
the last reply or have you got any progress on this issue? If you need any
further assistance, please feel free to post here.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
hi Steven,

I also have the similar problem. i am not able to copy the image file
from the remote machine to the client machine dynamically at the
specified location at the run time through ASp.net using VB.net.Can you
please help me regarding this.


Looking forward to hearing from you soon.

Regards,
Amit Singla
Software Engineer
 
hi Steven,

I also have the similar problem. i am not able to copy the image file
from the remote machine to the client machine dynamically at the
specified location at the run time through ASp.net using VB.net.Can you
please help me regarding this.


Looking forward to hearing from you soon.

Regards,
Amit Singla
Software Engineer
 
Copy Files To Server

Hi, I've The Same Problem.

I Can't Copy A Local File To Some Server With File.copy In Vb.net,,, For Example: (source, Destination) If Destination Is A Url Path, The File Haven´t Been Copied.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top