By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

File.Copy Method timing issues.

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.)

Nov 18 '05 #2

P: n/a

Hi,

Thanks for replying (twice). I made a couple of changes programatically
that may have solved my problem.

1) I removed a loop, that because of other reasons, I no longer needed.
2) I removed a random number generator I was using to come up with a
unique file name and added time stamp. I may be crazy, but It seems to
me that the random number generator in .net is not all that random.

I have run about 50 tests without getting the error. Still more testing
to go, because it was sporatic in the first place, but hopefully, that
did the trick.

Thanks

Brian
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

P: n/a
Hi Brian,
Thanks for your followup and the latest info you provided. I'm glad you've
got progress on this issue. In addition, if you meet problem in the
furture, please always feel free to post here. We are willing to help you.

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.)

Nov 18 '05 #4

P: n/a
Brian,
2) I removed a random number generator I was using to come up with a
unique file name and added time stamp. I may be crazy, but It seems to
me that the random number generator in .net is not all that random.


FYI - The GetUniqueFileName method of Toolkit will generate a truly
unique filename for you. That method also works for simultaneous
unique name creation across processes and threads.

Tim Sullivan
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.