
Originally Posted by
PascalUK
Hi,
Dim fs
fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile(Server.MapPath("File.txt"), Server.MapPath("newFile.txt"))
Note that this is ASP not ASP.Net code that you are using. Under Medium Trust you are not allowed to create ActiveX objects (if my memory serves me).
Try this code
Code:
Try
Dim sourceFile AsString = Server.MapPath("test.txt")
Dim destinationFile AsString = Server.MapPath("tester" & DateTime.Now.ToString("MMddyyy") & ".txt")
System.IO.File.Copy(sourceFile, destinationFile)
Catch Ex As Exception
Response.Write(Ex.Message)
EndTry
I have tested this in my test enviroment and it works in Medium Trust, and I'm using .Net2
Hope it helps
Bookmarks