vb.net - How to read txt share file in Local Area Network locked password -
i managed read contents of file untitle.txt on computer using local area network using vb .net code.
dim filereader system.io.streamreader filereader = my.computer.filesystem.opentextfilereader("\\192.168.10.1\test\untitle.txt") dim stringreader string stringreader = filereader.readline() msgbox(stringreader).
but how additional writing enter username , password script when computer read using username , password?
you can try this, should work :
public class form1 private sub button1_click(sender object, e eventargs) handles button1.click dim mycredentials new networkcredential("", "", "") mycredentials.domain = "http://192.168.10.1/" mycredentials.username = "admin" mycredentials.password = "admin" dim mywebrequest webrequest = webrequest.create("http://192.168.10.1/test/untitle.txt") mywebrequest.credentials = mycredentials dim httpresponse httpwebresponse httpresponse = mywebrequest.getresponse() dim reader new streamreader(httpresponse.getresponsestream()) richtextbox1.text = reader.readtoend end sub end class
hope worked :)
Comments
Post a Comment