Link to home
Start Free TrialLog in
Avatar of ispcorp
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(paramFileName)
        appWord.Visible = True
    End Sub
Private Sub getAndLoadFileName(ByVal paramBaseCode As String)
        Dim myDir As DirectoryInfo = New DirectoryInfo("\\DOMAIN\SHARED_FOLDER")
        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("opendoclist", "<script language='javascript'>window.open('doclist.aspx?reportid=" & paramBaseCode & "','document_list','height=200,width=400,status=no,toolbar=no,menubar=no,location=no')</script>")
            Else
                strFileName = fileInfos(0).FullName
                openWordDocument(strFileName)
            End If
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of raterus
raterus
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ispcorp
ispcorp

ASKER

Yes, I ran across this same article, but don't you impersonate the user within the server thats running the asp.net application.  This computer that I'm trying to access doesn't have an account on the computer running asp.net, so if I try to impersonate the user, wouldn't the login fail on the computer hosting the asp.net application?
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.
Avatar of ispcorp

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?
Avatar of ispcorp

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.
Avatar of ispcorp

ASKER

Turns out impersonation works...Thanks for you help....