ispcorp
asked on
Remote login for System.IO
Hello,
Does anybody know how I would go about sending login information so I can perform some System.IO operations on a remote computer.
The error its giving me is the following..."The account used is a computer account. Use your global user account or local user account to access this server".
I don't want to go to the remote computer and set up access for the ASPNET account...I would rather just send login information.
Here is a snippet of my code....
Private Sub openWordDocument(ByVal paramFileName As String)
Dim appWord As Word.Application
Dim appDoc As Word.Document
appDoc = appWord.Documents.Open(par amFileName )
appWord.Visible = True
End Sub
Private Sub getAndLoadFileName(ByVal paramBaseCode As String)
Dim myDir As DirectoryInfo = New DirectoryInfo("\\DOMAIN\SH ARED_FOLDE R")
Dim fileInfos() As FileInfo
Dim intNumberOfMatchingFiles As Int32
Dim strFileName As String
Try
fileInfos = myDir.GetFiles("*" & paramBaseCode & "*") <------ERROR IS HAPPENING HERE
intNumberOfMatchingFiles = fileInfos.Length
If intNumberOfMatchingFiles > 1 Then
Page.RegisterStartupScript ("opendocl ist", "<script language='javascript'>wind ow.open('d oclist.asp x?reportid =" & paramBaseCode & "','document_list','height =200,width =400,statu s=no,toolb ar=no,menu bar=no,loc ation=no') </script>" )
Else
strFileName = fileInfos(0).FullName
openWordDocument(strFileNa me)
End If
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
Does anybody know how I would go about sending login information so I can perform some System.IO operations on a remote computer.
The error its giving me is the following..."The account used is a computer account. Use your global user account or local user account to access this server".
I don't want to go to the remote computer and set up access for the ASPNET account...I would rather just send login information.
Here is a snippet of my code....
Private Sub openWordDocument(ByVal paramFileName As String)
Dim appWord As Word.Application
Dim appDoc As Word.Document
appDoc = appWord.Documents.Open(par
appWord.Visible = True
End Sub
Private Sub getAndLoadFileName(ByVal paramBaseCode As String)
Dim myDir As DirectoryInfo = New DirectoryInfo("\\DOMAIN\SH
Dim fileInfos() As FileInfo
Dim intNumberOfMatchingFiles As Int32
Dim strFileName As String
Try
fileInfos = myDir.GetFiles("*" & paramBaseCode & "*") <------ERROR IS HAPPENING HERE
intNumberOfMatchingFiles = fileInfos.Length
If intNumberOfMatchingFiles > 1 Then
Page.RegisterStartupScript
Else
strFileName = fileInfos(0).FullName
openWordDocument(strFileNa
End If
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
are we dealing with a domain here?, or is this something across a workgroup (I'm not really sure about those). Domains are easy, just put a valid domain user and make sure they have NTFS permissions on the other computer's share.
ASKER
Well, the computer that I'm running the ASP.NET application is part of a domain, but the computer I'm trying to access is by itself, and not part of anything.....
I'm not much of a network guy, how can you tell if a computer is part of a network domain or not?
I'm not much of a network guy, how can you tell if a computer is part of a network domain or not?
ASKER
Oh, my bad...I just found it...Yes, its part of a domain.
Ok, then just use the code to impersonate a specific user, and use a valid domain user which has access to the filesystem on the other computer.
ASKER
Turns out impersonation works...Thanks for you help....
ASKER