System.IO.FileNotFoundException using file.copy

S

Stephen Witter

I am trying to copy a file to a network drive. I can do it on the
domain controller/web server but not from a client. Here is the code:

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity =
CType(User.Identity,System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
dim Temp as string="TestFile"
File.Copy("\\MyServer\Template.doc", "\\MyServer\" & Temp &".doc")

impersonationContext.Undo()

I get the error "System.IO.FileNotFoundException: Could not find file
\\Server\File..." when running it from the [authenticated] client
browser. I searched everywhere on the web and MSDN on this error but found
nothing. The error it occurs on the file copy statement The file.copy
statement is trying to copy a file on a different server than the web
server.

Any help is appreciated.
 
S

She Ven Ng

I also facing the same problem. Did u manager to solve ur problem? If
yes, can u pls post ur solution?
Thanks.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top