Results 1 to 7 of 7

Thread: login in machine of another domain and access file

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    3

    login in machine of another domain and access file

    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

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: login in machine of another domain and access file

    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.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: login in machine of another domain and access file

    Hey chris, Process.Start() is for .Net, I think the OP needs something for VB6.0.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    3

    Re: login in machine of another domain and access file

    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

  5. #5
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: login in machine of another domain and access file

    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?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    3

    Re: login in machine of another domain and access file

    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)

  7. #7
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: login in machine of another domain and access file

    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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width