Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: System.IO.File.Copy not copying and no error

Reply
Thread Tools

Re: System.IO.File.Copy not copying and no error

 
 
David Waz...
Guest
Posts: n/a
 
      07-06-2003
I'd suggest wrapping the copy in a Try/Catch block just to be sure. Then
throw a new exception, outputing your source/destination paths along with
the original exception:

Try
System.IO.File.Copy(Source,Dest)
Catch ex as exception
throw new Exception("Source: '" & source & "' - Dest: '" & dest &
"'",ex)
end try

also, put a break point at the Throw, and examine your variables.



"Xander Q." <> wrote in message
news: om...
> Something really strange is happening. i'm using the following code to
> copy a file. this worked on my development machine, but when i moved
> it to the server (win2k) it is not copying the file and not generating
> an error. it just merrily goes on.
>
> --------------------------------------------------------------------
> source= Server.MapPath("/TTClaimsForm2/Reports/xxx.doc")
> dest= Server.MapPath("/TTClaimsForm2/Reports/Temp/xxx.doc")
>
> System.IO.File.Copy(source, dest)
> --------------------------------------------------------------------
>
>
> i checked the value of dest and it's correct. i replaced it with an
> empty string and it gave an error as expected.
>
> BUT i noticed that if i hard code destination like this:
> System.IO.File.Copy(source,
> "C:\inetpub\wwwroot\ttclaimsform2\Temp\xxx.doc ") then the copy works.
>
> how can this be happening?



 
Reply With Quote
 
 
 
 
Xander Q.
Guest
Posts: n/a
 
      07-07-2003
"David Waz..." <> wrote in message news:<bhZNa.1682$ om>...
> I'd suggest wrapping the copy in a Try/Catch block just to be sure. Then
> throw a new exception, outputing your source/destination paths along with
> the original exception:



ah yes i neglected to mention that i already did that, and the value
of 'dest' is correct. it is the same as the hard-coded string and yet
it fails...

damn i hate this stuff!!!

but thx for the input...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Emacs VHDL-mode Next-Error, Previous-Error, and First-Error are not working...? BlackHelicopter VHDL 2 02-12-2013 01:12 AM
Error Info Code: 3627 Copying new IOS images rzepson Cisco 1 04-18-2006 10:22 AM
Error copying dll to webserver VS 2003 - server connection timed o =?Utf-8?B?QW50aG9ueSBCYW5rcw==?= ASP .Net 0 11-09-2004 03:26 PM
error copying configs from ftp server wilson Cisco 0 04-08-2004 02:45 PM
error while copying ios image from flash to tftp or ftp server Saket Badola Cisco 3 04-05-2004 06:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57