473,756 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File.Copy Method timing issues.

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\w atever.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
4 2643
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

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
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
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 GetUniqueFileNa me 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
9123
by: J. Campbell | last post by:
OK...I'm in the process of learning C++. In my old (non-portable) programming days, I made use of binary files a lot...not worrying about endian issues. I'm starting to understand why C++ makes it difficult to read/write an integer directly as a bit-stream to a file. However, I'm at a bit of a loss for how to do the following. So as not to obfuscate the issue, I won't show what I've been attempting ;-) What I want to do is the...
42
5804
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same kind. It sounds simple but evidently .NET has difficulty with this concept for some reason. I do understand that .NET objects are created on the GC heap but that doesn't mean that they couldn't be copied from another object of the same kind when...
9
1954
by: Vai2000 | last post by:
Hi All, Here's a situation, I am trying to process some large Files via a Win Svc using FileMonitor. During the test process I tried copy and pasting a file in a folder and got an error saying "Process can't access the file foo.txt as it is being used by another process". I believe the Copy operation hasn't finished yet though my WinSvc kicked in.....since it got a FileChange Notification... How can I avoid the Race Condition? TIA
18
20185
by: Conrad F | last post by:
Hello all, I am waiting for receipt of files in a directory. I use the FileSystemWatcher to detect when files arrive in said folder. I need to read the data from these files ASAP but the files are created and detected before writing completes and so I cannot read them until the file handle used in their creation has been released. This would be easy to get around with file renaming or other file locking mechanisms which I could use...
1
6508
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
5
1749
by: =?Utf-8?B?dWxpbGxpbGxpYQ==?= | last post by:
I've had two issues plaguing me for 4 months now and I haven't gotten anywhere. I'm into making 2D games and these things are essential to games. These are my issues: 1. I need timing precise to about 4 milliseconds at most. Currently, I've been using the clock() function, but it's only precise to 1/64 second (or about 15.6 milliseconds). For those running their monitor at 60 Hz, this isn't much of a problem, but for those running...
2
1296
by: joe | last post by:
I am loading a text file to a variable with XMLHttpRequest() There seems to be some sort of timing issue since loadXML (source code below) returns the contents of the file on seconds try. In Firefox I get an empty string. No errors are reported. If I look at the code with Firefox debugger (Venkman) everything works fine. I should probably put a loop somewhere to check when loading the file is finished. var xmlhttp;
5
3052
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a .Net web service that converts the MODCA files to tif or png file format. This web service runs on a 2003 server. This web service first copies the MODCA file to be converted to a temporary conversion folder. Then it converts it to the desired file format and copies the file to the output folder specified. Then it deletes the converted file from the temporary conversion folder. Then it attempts to delete the copied input file...
2
2704
by: Visine_Eyes | last post by:
What .NET mechanism should I use to resolve permission issues before I begin to copy directory structure/file(s) from one computer to another. I have tried Try/Catch statement using DirectoryInfo and FileInfo but process halts on error. The computers have Vista or XP Pro installed. Each computer is attached to a Win 2003 or Win 2008 server.
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.