PDA

Click to See Complete Forum and Search --> : Matthew Gates... Please help...


eer3
Feb 22nd, 2001, 03:51 PM
I read your post on wnetconnectiondialog1 and also a similar one on MSDN. Great stuff. Thanks!

The drive map dialog is exactly what I needed, except that...

how do you put some text in the "Connect as:" textbox on the dialog box??? (I'd like to have it put the Domain name\username in the box automatically)

Can it be done??? If anyone were to know, I guessed it would be you.

Thanks in advance

p.s heres the MSDN article:
http://support.microsoft.com/support/kb/articles/Q177/6/98.asp

Feb 22nd, 2001, 04:03 PM
Couldn't you just make your own form and use this code and already have a letter in the textbox(es)?


Private Declare Function WNetAddConnection Lib "mpr.dll" Alias
"WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszstrPassword As
String, ByVal lpszLocalName As String) As Long


Private Sub Command1_Click()

Dim strLocalDriveLetter As String
Dim strPassword As String
Dim strNetworkPathName As String

strLocalDriveLetter = "K:" 'Local drive letter to be mapped
strPassword = "" 'specify network password if required
strNetworkPathName = "\\NETWORKPATH\VOL1" 'path to network drive

If WNetAddConnection(strNetworkPathName, _
strPassword, strLocalDriveLetter) > 0 Then
MsgBox ("An Error occurred mapping the drive")
Else
MsgBox ("Drive successfully mapped!")
End If

End Sub

eer3
Feb 22nd, 2001, 04:12 PM
I had done that at first.

The WNetAddConnection won't do it though, I had to use WNetAddConnection2, so that I could supply username and password.(I'm working on a NT platform across domains that are not trusted) When sending username with WNetAddConnection2, I just added "domainname\" to the username and all works well.

But does this pose security issues, sending the password this way? It seems better to uses the Map Drive Dialog and let NT handle the security.

Thanks for your response, any suggestions are greatly appreciated.

barrk
Feb 23rd, 2001, 09:25 AM
Just bringing this to the top again....as we still need more suggestions if anyone has any!

Thanks in advance for your help!!!!

parksie
Feb 25th, 2001, 11:43 AM
I would have thought that the NT drive mapper would use this function, and as such depending on your settings would either send a clear or hashed password.

eer3
Feb 25th, 2001, 01:24 PM
parksie,

Yes, you are right.

The problem is that the users are not on our domain. (for some idiotic security reason we cannot have trusted domains) When these remote users try to map a drive, it sends their local NT username/password, which don't exist on our domain. We need to authenticate the username/password that does exists on our domain.

This all works fine in the Drive Map Dialog, as long as the user is smart enough put in ourdomain\username into the "Connect As:" section of the Drive Map Dialog box.

So, the question is... Is there a way to populate the "Connect As:" text box of the Drive Map Dialog?