Click to See Complete Forum and Search --> : login in machine of another domain and access file
hi_prajakta
Jan 4th, 2009, 07:39 AM
hi,
I want to access a wave file which is another domain using vb 6.0.
which i want to play in media player
i access by following path
\\IP addess\drive name\foldername\file name
but it is not playing file it.
But when i open that machine by start->run-> \\IP of machine
Then i need to give user id and password to open that machine
If I follow above process then my Vb application start playing my selected file
But i want to avoid it.
So how can i pass user id and password of another system to login in vb code
so that i can directly play the file
Please suggest.
Thank in advance
Prajakata
chris128
Jan 4th, 2009, 04:49 PM
Depends how you are playing the file - if you are using something like Process.Start() to launch media player and pass it the file location then you could use the username and password arguments of that method to make it use valid credentials.
Another way would be to run the Net Use command (via Shell or Process.Start) and specify the directory location and username/password in there but thats far from ideal as you are having to rely on an external program then.
Of course the real solution is to grant the users access to the file via NTFS permissions or Sharing permissions (so that they dont need to enter a username and password) OR move the file to a location where the users already have access.
dee-u
Jan 4th, 2009, 04:52 PM
Hey chris, Process.Start() is for .Net, I think the OP needs something for VB6.0.
hi_prajakta
Jan 4th, 2009, 10:20 PM
Thanks for reply,
My VB code is as below
getrecording_name = MSHFlexGrid1.TextMatrix(get_pos1, 6)
If Trim(getrecording_name) <> "" Then
get_connid = Mid(getrecording_name, 48, 16)
txtconnid.Text = get_connid
file_name = "\\10.172.25.5" & getrecording_name & "_pcma.wav"
' sndPlaySound file_name, SND_ASYNC Or SND_NODEFAULT
Winplayer.URL = file_name
Winplayer.Controls.play
To Parameter file_name how can i pass userid and passowrd to login in machine 10.172.25.5
So Plz. reply
chris128
Jan 5th, 2009, 05:23 AM
I'll say again:
Of course the real solution is to grant the users access to the file via NTFS permissions or Sharing permissions (so that they dont need to enter a username and password) OR move the file to a location where the users already have access.
Is there any reason why this cant be done?
hi_prajakta
Jan 5th, 2009, 05:54 AM
thnks for help
i got sol'n i used dos net use command in visual basic
to get access of machine
code is like in visual basic 6.0
shell(net use r:\\IP of machine /user: usernameof computer pwd)
chris128
Jan 5th, 2009, 06:02 AM
You dont need to use the r: bit. I mean, you dont have to map a network drive just for the sake of providing username and password. Some users may not like the fact that they now have an R drive just for the sake of playing this media file in your program.
So instead (if you insist on using the Net Use command) you can just do this:
Net Use \\IP\Share\etc /user:username password
Also, you might want to make sure that you remove this connection when your done playing the file or when your program closes etc, so for example this could go in your form closing code:
Net Use \\IP\Share\etc /delete /yes
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.