Remote login for System.IO

Posted on 2005-04-27
Medium Priority
Last Modified: 2008-02-01
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

            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>")
                strFileName = fileInfos(0).FullName
            End If
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
Question by:ispcorp
  • 4
  • 3
LVL 33

Accepted Solution

raterus earned 2000 total points
ID: 13877710
You can impersonate a specific user in code, example here (scroll down)

Author Comment

ID: 13878010
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?
LVL 33

Expert Comment

ID: 13878037
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.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 13878143
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?

Author Comment

ID: 13878155
Oh, my bad...I just found it...Yes, its part of a domain.
LVL 33

Expert Comment

ID: 13878168
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.

Author Comment

ID: 13878793
Turns out impersonation works...Thanks for you help....

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question