Impersonation when performing IO operation using File.Copy

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

  1. #1

    Default Impersonation when performing IO operation using File.Copy

    Hello,
    I am trying to implement impersonation for the copying file from one remote
    directory to the other remote drive on the same server in ASP.Net page.

    Impersonation seems to be working fine. It seems to perform the
    impersonation but when it tries to copy the file then it raises the exception
    'Could not find the specified "...."'.

    I am sure that the file exists in that folder but still it is raising the
    same error everytime.

    Here is detail of the complete error

    Server Error in '/' Application
    --------------------------------------------------------------------------------

    Could not find file "\\remotecomputer\C$\Asset\1_4.wmv".
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information about
    the error and where it originated in the code.

    Exception Details: System.IO.FileNotFoundException: Could not find file
    "\\remotecomputer\C$\Asset\1_4.wmv".

    Source Error:

    An unhandled exception was generated during the execution of the current web
    request. Information regarding the origin and location of the exception can
    be identified using the exception stack trace below.

    Stack Trace:


    [FileNotFoundException: Could not find file
    "\\remotecomputer\C$\Asset\1_4.wmv".]
    System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
    System.IO.File.InternalCopy(String sourceFileName, String destFileName,
    Boolean overwrite) +314
    System.IO.File.Copy(String sourceFileName, String destFileName) +7
    SampleDailies.createclip.CreateFile() in
    C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:159
    SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
    C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:28
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Page.ProcessRequestMain() +750


    Thanks,
    Bhupendra


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
    Version:1.1.4322.2032

    Bunty Guest

  2. Similar Questions and Discussions

    1. Impersonation problem - logs on ok but no file access ?? Please help!
      Hi, I am writing a windows forms app and i need to access a fileshare but impersonating another user (rather than the userlogged on). All my code...
    2. Best Practices for Impersonation and File Upload?
      Grant ASPNET permissions to the folder, assuming the folder is on the same server IIS is running. If not, you'll have to go for another option. ...
    3. Error: Could not complete this operation. The file could not be found.
      When attempting to open .psd, .jpg, .gif, and other image files in Adobe ImageReady CS, I'm frequently, sporadically, and without rhyme or reason,...
    4. HELP! File name or class name not found during Automation operation
      Could someone point me in the right direction? I've migrated three FrontPage 2002 websites to a new web server. Each web site has a Access 2000...
    5. The file 'bin\WebProj.dll' cannot be copied to the run directory. The requested operation cannot be performed on a file with a user-mapped section open.
      Hi, All, I got this error when trying to compile a web project. The file 'bin\Kennel.dll' cannot be copied to the run directory. The requested...
  3. #2

    Default Re: Impersonation when performing IO operation using File.Copy

    Hi Bhupendra

    Does the impersonated identity hav permissions on
    "\\remotecomputer\C$\Asset\1_4.wmv" ?
    Cause of "C$" is the identity admin?

    --
    Daniel Fisher(lennybacon)
    MCP ASP.NET C#
    Blog: [url]http://www.lennybacon.com/[/url]


    "Bunty" <Bunty@discussions.microsoft.com> wrote in message
    news:DA572378-FF33-469E-A484-DEF5B56D49A9@microsoft.com...
    > Hello,
    > I am trying to implement impersonation for the copying file from one
    > remote
    > directory to the other remote drive on the same server in ASP.Net page.
    >
    > Impersonation seems to be working fine. It seems to perform the
    > impersonation but when it tries to copy the file then it raises the
    > exception
    > 'Could not find the specified "...."'.
    >
    > I am sure that the file exists in that folder but still it is raising the
    > same error everytime.
    >
    > Here is detail of the complete error
    >
    > Server Error in '/' Application.
    > --------------------------------------------------------------------------------
    >
    > Could not find file "\\remotecomputer\C$\Asset\1_4.wmv".
    > Description: An unhandled exception occurred during the execution of the
    > current web request. Please review the stack trace for more information
    > about
    > the error and where it originated in the code.
    >
    > Exception Details: System.IO.FileNotFoundException: Could not find file
    > "\\remotecomputer\C$\Asset\1_4.wmv".
    >
    > Source Error:
    >
    > An unhandled exception was generated during the execution of the current
    > web
    > request. Information regarding the origin and location of the exception
    > can
    > be identified using the exception stack trace below.
    >
    > Stack Trace:
    >
    >
    > [FileNotFoundException: Could not find file
    > "\\remotecomputer\C$\Asset\1_4.wmv".]
    > System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
    > System.IO.File.InternalCopy(String sourceFileName, String destFileName,
    > Boolean overwrite) +314
    > System.IO.File.Copy(String sourceFileName, String destFileName) +7
    > SampleDailies.createclip.CreateFile() in
    > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:159
    > SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
    > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:28
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +35
    > System.Web.UI.Page.ProcessRequestMain() +750
    >
    >
    > Thanks,
    > Bhupendra
    >
    >
    > --------------------------------------------------------------------------------
    > Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
    > ASP.NET
    > Version:1.1.4322.2032
    >

    Daniel Fisher\(lennybacon\) Guest

  4. #3

    Default Re: Impersonation when performing IO operation using File.Copy

    Hi Daniel,

    Thanks for your reply,

    Yes, user does have permission to the specified folder. I am impersonating
    domain user which has all the permissions on the folder.

    And the error I am getting is not at all is related to the permissions. It
    does not find the file at all. And file does exist in that folder but it
    still raises "Could not find file'' " error.

    Thanks,
    Bhupendra



    "Daniel Fisher(lennybacon)" wrote:
    > Hi Bhupendra
    >
    > Does the impersonated identity hav permissions on
    > "\\remotecomputer\C$\Asset\1_4.wmv" ?
    > Cause of "C$" is the identity admin?
    >
    > --
    > Daniel Fisher(lennybacon)
    > MCP ASP.NET C#
    > Blog: [url]http://www.lennybacon.com/[/url]
    >
    >
    > "Bunty" <Bunty@discussions.microsoft.com> wrote in message
    > news:DA572378-FF33-469E-A484-DEF5B56D49A9@microsoft.com...
    > > Hello,
    > > I am trying to implement impersonation for the copying file from one
    > > remote
    > > directory to the other remote drive on the same server in ASP.Net page.
    > >
    > > Impersonation seems to be working fine. It seems to perform the
    > > impersonation but when it tries to copy the file then it raises the
    > > exception
    > > 'Could not find the specified "...."'.
    > >
    > > I am sure that the file exists in that folder but still it is raising the
    > > same error everytime.
    > >
    > > Here is detail of the complete error
    > >
    > > Server Error in '/' Application.
    > > --------------------------------------------------------------------------------
    > >
    > > Could not find file "\\remotecomputer\C$\Asset\1_4.wmv".
    > > Description: An unhandled exception occurred during the execution of the
    > > current web request. Please review the stack trace for more information
    > > about
    > > the error and where it originated in the code.
    > >
    > > Exception Details: System.IO.FileNotFoundException: Could not find file
    > > "\\remotecomputer\C$\Asset\1_4.wmv".
    > >
    > > Source Error:
    > >
    > > An unhandled exception was generated during the execution of the current
    > > web
    > > request. Information regarding the origin and location of the exception
    > > can
    > > be identified using the exception stack trace below.
    > >
    > > Stack Trace:
    > >
    > >
    > > [FileNotFoundException: Could not find file
    > > "\\remotecomputer\C$\Asset\1_4.wmv".]
    > > System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
    > > System.IO.File.InternalCopy(String sourceFileName, String destFileName,
    > > Boolean overwrite) +314
    > > System.IO.File.Copy(String sourceFileName, String destFileName) +7
    > > SampleDailies.createclip.CreateFile() in
    > > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:159
    > > SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
    > > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:28
    > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > System.Web.UI.Control.LoadRecursive() +35
    > > System.Web.UI.Page.ProcessRequestMain() +750
    > >
    > >
    > > Thanks,
    > > Bhupendra
    > >
    > >
    > > --------------------------------------------------------------------------------
    > > Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
    > > ASP.NET
    > > Version:1.1.4322.2032
    > >
    >
    >
    >
    Bunty Guest

  5. #4

    Default Re: Impersonation when performing IO operation using File.Copy

    Hi Danial,

    I guess I did not read your response very carefully. I did not understand
    the what you mean by identity admin?

    Actual remote path in my case looks like
    '\\remotecomputer\remotefolder1\folder2\folder3' and the error message i am
    getting is 'Could not find part of the path "\\remotecomputer\remotefolder" '.

    Thanks,
    Bhupendra

    "Daniel Fisher(lennybacon)" wrote:
    > Hi Bhupendra
    >
    > Does the impersonated identity hav permissions on
    > "\\remotecomputer\C$\Asset\1_4.wmv" ?
    > Cause of "C$" is the identity admin?
    >
    > --
    > Daniel Fisher(lennybacon)
    > MCP ASP.NET C#
    > Blog: [url]http://www.lennybacon.com/[/url]
    >
    >
    > "Bunty" <Bunty@discussions.microsoft.com> wrote in message
    > news:DA572378-FF33-469E-A484-DEF5B56D49A9@microsoft.com...
    > > Hello,
    > > I am trying to implement impersonation for the copying file from one
    > > remote
    > > directory to the other remote drive on the same server in ASP.Net page.
    > >
    > > Impersonation seems to be working fine. It seems to perform the
    > > impersonation but when it tries to copy the file then it raises the
    > > exception
    > > 'Could not find the specified "...."'.
    > >
    > > I am sure that the file exists in that folder but still it is raising the
    > > same error everytime.
    > >
    > > Here is detail of the complete error
    > >
    > > Server Error in '/' Application.
    > > --------------------------------------------------------------------------------
    > >
    > > Could not find file "\\remotecomputer\C$\Asset\1_4.wmv".
    > > Description: An unhandled exception occurred during the execution of the
    > > current web request. Please review the stack trace for more information
    > > about
    > > the error and where it originated in the code.
    > >
    > > Exception Details: System.IO.FileNotFoundException: Could not find file
    > > "\\remotecomputer\C$\Asset\1_4.wmv".
    > >
    > > Source Error:
    > >
    > > An unhandled exception was generated during the execution of the current
    > > web
    > > request. Information regarding the origin and location of the exception
    > > can
    > > be identified using the exception stack trace below.
    > >
    > > Stack Trace:
    > >
    > >
    > > [FileNotFoundException: Could not find file
    > > "\\remotecomputer\C$\Asset\1_4.wmv".]
    > > System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
    > > System.IO.File.InternalCopy(String sourceFileName, String destFileName,
    > > Boolean overwrite) +314
    > > System.IO.File.Copy(String sourceFileName, String destFileName) +7
    > > SampleDailies.createclip.CreateFile() in
    > > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:159
    > > SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
    > > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:28
    > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > System.Web.UI.Control.LoadRecursive() +35
    > > System.Web.UI.Page.ProcessRequestMain() +750
    > >
    > >
    > > Thanks,
    > > Bhupendra
    > >
    > >
    > > --------------------------------------------------------------------------------
    > > Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
    > > ASP.NET
    > > Version:1.1.4322.2032
    > >
    >
    >
    >
    Bunty Guest

  6. #5

    Default Re: Impersonation when performing IO operation using File.Copy

    Bunty..
    I have made a similar application and ur error see WIERD!
    U said u have impersonated but are u usre the user has access to the
    FOLDERS..and is it well shared..
    Does the server u are copying the files to have ASPNET acct?
    If u can try posting the code u are using..
    Hope this helps.
    Patrick







    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Patrick Olurotimi Ige Guest

  7. #6

    Default Re: Impersonation when performing IO operation using File.Copy

    Patrick,

    Yes, the remote server is also running ASPNET acct. It is also running IIS6
    for some other purpose.

    Folders on the remote server are well shared and also assigned proper
    permissions to the folder and to the domain user (the user I am trying to
    impersonate).

    Thanks,
    Bunty

    "Patrick Olurotimi Ige" wrote:
    > Bunty..
    > I have made a similar application and ur error see WIERD!
    > U said u have impersonated but are u usre the user has access to the
    > FOLDERS..and is it well shared..
    > Does the server u are copying the files to have ASPNET acct?
    > If u can try posting the code u are using..
    > Hope this helps.
    > Patrick
    >
    >
    >
    >
    >
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    >
    Bunty Guest

  8. #7

    Default Re: Impersonation when performing IO operation using File.Copy

    Bunty...ok then..
    But is the error still active?
    Patrick


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Patrick Olurotimi Ige Guest

  9. #8

    Default Re: Impersonation when performing IO operation using File.Copy

    Yes, error is still active and i am trying to figure out the solution for that.
    Thanks,
    Bhupendra

    "Patrick Olurotimi Ige" wrote:
    > Bunty...ok then..
    > But is the error still active?
    > Patrick
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    >
    Bunty Guest

  10. #9

    Default Re: Impersonation when performing IO operation using File.Copy

    You need search more info about delegation.

    "Bunty" <Bunty@discussions.microsoft.com> wrote in message
    news:77D1AD49-B6D4-41B7-81EC-5E191E9F2272@microsoft.com...
    > Hi Daniel,
    >
    > Thanks for your reply,
    >
    > Yes, user does have permission to the specified folder. I am impersonating
    > domain user which has all the permissions on the folder.
    >
    > And the error I am getting is not at all is related to the permissions. It
    > does not find the file at all. And file does exist in that folder but it
    > still raises "Could not find file'' " error.
    >
    > Thanks,
    > Bhupendra
    >
    >
    >
    > "Daniel Fisher(lennybacon)" wrote:
    >
    >> Hi Bhupendra
    >>
    >> Does the impersonated identity hav permissions on
    >> "\\remotecomputer\C$\Asset\1_4.wmv" ?
    >> Cause of "C$" is the identity admin?
    >>
    >> --
    >> Daniel Fisher(lennybacon)
    >> MCP ASP.NET C#
    >> Blog: [url]http://www.lennybacon.com/[/url]
    >>
    >>
    >> "Bunty" <Bunty@discussions.microsoft.com> wrote in message
    >> news:DA572378-FF33-469E-A484-DEF5B56D49A9@microsoft.com...
    >> > Hello,
    >> > I am trying to implement impersonation for the copying file from one
    >> > remote
    >> > directory to the other remote drive on the same server in ASP.Net page.
    >> >
    >> > Impersonation seems to be working fine. It seems to perform the
    >> > impersonation but when it tries to copy the file then it raises the
    >> > exception
    >> > 'Could not find the specified "...."'.
    >> >
    >> > I am sure that the file exists in that folder but still it is raising
    >> > the
    >> > same error everytime.
    >> >
    >> > Here is detail of the complete error
    >> >
    >> > Server Error in '/' Application.
    >> > --------------------------------------------------------------------------------
    >> >
    >> > Could not find file "\\remotecomputer\C$\Asset\1_4.wmv".
    >> > Description: An unhandled exception occurred during the execution of
    >> > the
    >> > current web request. Please review the stack trace for more information
    >> > about
    >> > the error and where it originated in the code.
    >> >
    >> > Exception Details: System.IO.FileNotFoundException: Could not find file
    >> > "\\remotecomputer\C$\Asset\1_4.wmv".
    >> >
    >> > Source Error:
    >> >
    >> > An unhandled exception was generated during the execution of the
    >> > current
    >> > web
    >> > request. Information regarding the origin and location of the exception
    >> > can
    >> > be identified using the exception stack trace below.
    >> >
    >> > Stack Trace:
    >> >
    >> >
    >> > [FileNotFoundException: Could not find file
    >> > "\\remotecomputer\C$\Asset\1_4.wmv".]
    >> > System.IO.__Error.WinIOError(Int32 errorCode, String str) +181
    >> > System.IO.File.InternalCopy(String sourceFileName, String
    >> > destFileName,
    >> > Boolean overwrite) +314
    >> > System.IO.File.Copy(String sourceFileName, String destFileName) +7
    >> > SampleDailies.createclip.CreateFile() in
    >> > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:159
    >> > SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
    >> > C:\Web\Technicolor\SampleDailies\MediaAdministrati on\createclip.aspx.vb:28
    >> > System.Web.UI.Control.OnLoad(EventArgs e) +67
    >> > System.Web.UI.Control.LoadRecursive() +35
    >> > System.Web.UI.Page.ProcessRequestMain() +750
    >> >
    >> >
    >> > Thanks,
    >> > Bhupendra
    >> >
    >> >
    >> > --------------------------------------------------------------------------------
    >> > Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
    >> > ASP.NET
    >> > Version:1.1.4322.2032
    >> >
    >>
    >>
    >>

    Oleg 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