Impersonation when performing IO operation using File.Copy

B

Bunty

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\MediaAdministration\createclip.aspx.vb:159
SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
C:\Web\Technicolor\SampleDailies\MediaAdministration\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
 
D

Daniel Fisher\(lennybacon\)

Hi Bhupendra

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

Bunty

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) said:
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: http://www.lennybacon.com/


Bunty said:
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\MediaAdministration\createclip.aspx.vb:159
SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
C:\Web\Technicolor\SampleDailies\MediaAdministration\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
 
B

Bunty

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) said:
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: http://www.lennybacon.com/


Bunty said:
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\MediaAdministration\createclip.aspx.vb:159
SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
C:\Web\Technicolor\SampleDailies\MediaAdministration\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
 
P

Patrick Olurotimi Ige

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
 
B

Bunty

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
 
B

Bunty

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

Oleg

You need search more info about delegation.

Bunty said:
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) said:
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: http://www.lennybacon.com/


Bunty said:
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\MediaAdministration\createclip.aspx.vb:159
SampleDailies.createclip.Page_Load(Object sender, EventArgs e) in
C:\Web\Technicolor\SampleDailies\MediaAdministration\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
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top