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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -