file.copy problem

G

Guest

Hi

From my aspx page i am calling one of the console.exe. that exe will copy
the file from network to local webserver. everything hardcoded path. I given
all the permission to that exe. I am getting below error on last line

what am i doing wrong here.

Could not find file "\\laptop02\temp\test.pdf".

thanks
bala


Exe code:

Dim Targetpath As String
Dim sourcepath As String
For Each Arg As String In Args
sourcepath = Arg
Next Arg

sourcepath = "\\laptop02\temp\test.pdf"
Targetpath = "c:\inetpub\wwwroot\temp\"


Dim myFile As FileInfo
Dim myCopiedFile As FileInfo

'check if file exists, if so delete it
If File.Exists(Path:=Targetpath & Path.GetFileName(sourcepath)) Then
File.Delete(Path:=Targetpath & Path.GetFileName(sourcepath))
End If

'get the newly created file
myFile = New FileInfo(fileName:=sourcepath)
Console.WriteLine(sourcepath)
Console.WriteLine(Targetpath)


'overwrite an existing file if need be
myCopiedFile = myFile.CopyTo(destFileName:=Targetpath &
Path.GetFileName(sourcepath), overwrite:=True)
 
G

Guest

Give permissions to the Server\Share as well as the file/folder to the user
that ASP.NET is connecting as.
 
B

Bruce Barker

when you start a process, it runns under the creditials of the creating
process, not thread. generally this is the asp.net account, which is a local
account without network permissions. you have a couople options:

1) change the asp.net account to a domain account with network permissions
to your share.
2) use the CreateProcessAsUser api

-- bruce (sqlwork.com)
 
G

Guest

I created mapping to that networkmachine call X. when i go to permission
properties, i cannot give permission to my local aspnet account. its not
allowing me to do that. bcos the location says that network machine or my
domain. its not showing my local machine.

bala
 

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

Staff online

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top