System.IO.FileNotFoundException using file.copy

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default System.IO.FileNotFoundException using file.copy

    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.WindowsImpersonationCont ext
    Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
    currentWindowsIdentity =
    CType(User.Identity,System.Security.Principal.Wind owsIdentity)
    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.




    Stephen Witter Guest

  2. Similar Questions and Discussions

    1. FileNotFoundException
      I need some help. I generated an enum using EnumBuilder and created an assembly called EnumAssembly.dll into the bin directory of my web service. ...
    2. WebServices and getting FileNotFoundException
      From googling my problem before posting, I learned that this seems to be a very common problem with Web Services and dotnet. I read through...
    3. WebServices and FileNotFoundException
      Hey, I am a newbie to Web Services. I have been struggling with a very strange problem for days. I want to write a simple "Hello World" Web...
    4. Inheriting from the CollectionBase causes weird Error: System.IO.FileNotFoundException
      I am having a problem exposing a class inherited from the collection base class as a webservice. If I expose the collection on a web page all works...
    5. System.IO.File.Copy not copying and no error
      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...
  3. #2

    Default Re: System.IO.FileNotFoundException using file.copy



    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 [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    She Ven Ng Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139