Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getfiles Problem with User login on another pc.

Status
Not open for further replies.

jake007

Programmer
Jun 19, 2003
166
US

Problem with Getfiles and Login Information on the source pc.
Was this post helpful ?


I am using the following code to get a list of filenames from a directory on a pc on our network.

Dim query As String

Dim x As New System.IO.DirectoryInfo("\\shipping\ShippingC\KEWILL\CSWIN\ARCHIVE")

'Dim x As New System.IO.DirectoryInfo("C:\KEWILL\CSWIN\ARCHIVE")

Dim s() As System.IO.FileInfo = x.GetFiles("*.cs")

Dim a As New ArrayList

Dim tn As TreeNode

tn = New TreeNode("Dayfiles")

TreeView1.Nodes.Add(tn.Clone)

For Each dayfile As System.IO.FileInfo In s

tn = New TreeNode(dayfile.ToString)

'tn.Nodes.Add(dayfile.ToString)

TreeView1.Nodes.Add(tn.Clone)

Next



Everything works fine as long as I log into the pc manually, by using explorer, before running the app. Is there anyway I can pass the username/password in the getfiles funtion (or elsewhere) so that it will log into the pc properly on it own.



John




 
The only thing that I can think of other than using Active Directory, is mapping a network drive to W: for example.

If you don't know how to then:
1) Open a folder browser,
2) Goto the 'Tools' menu and select 'Map Network Drive...'
3) Select a Drive letter from the dropdown list, W:
4) Type the address into the Folder box: "\\shipping\ShippingC"
5) Tick the 'Reconnect at logon' box
6) Click the 'Connect using a different user name' link.
7) Set the username and password of an account on the other computer. Username: 'shipping\Username'
8) Ok/Finish to all

Then just use "W:\KEWILL\CSWIN\ARCHIVE" in your code.
The only problem I know with this, is that if the other computer is off when you switch yours on, it will fail to connect automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top