asp.net and permissions

  • Thread starter Thread starter Stephen Witter
  • Start date Start date
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()
'response.write(User.Identity.Name)
'response.end
dim Temp as string="TestFile"
File.Copy("\\MyServer\Template.doc", "\\MyServer\" & Temp &
".doc")

impersonationContext.Undo()

With or without impersonation I am getting errors, but it works fine,
as I said, on the domain controller. How do I specify a specific
individual when executing this code?
 
Hi Stephen,

Did you try this already in the newsgroup

microsoft.public.dotnet.security

Maybe you can find your answer there

Cor
 
I searched everywhere on the web and MSDN. I should be more specific
on the error. The error is "System.IO.FileNotFoundException: Could
not find file \\Server\File" and it occurs on the file copy statement
when run from a [authenticated] client's browser. The file.copy
statement is trying to copy a file on a different server than the web
server.
 
Back
Top