asp.net and permissions

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?
 
C

Cor Ligthert

Hi Stephen,

Did you try this already in the newsgroup

microsoft.public.dotnet.security

Maybe you can find your answer there

Cor
 
S

Stephen Witter

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.
 

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

Top