|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Replacement for Inet ControlThe following seemed so easy in VB6
Inet2.URL = HTTP://192.168.0.200/get?brightness Dim retval As String = AxInet2.OpenURL This would give me the string 'Brightness=34' (It's from a camera) How do I do it with VB.Net (2005)? I've trawled through loads of code using Webrowsers, HTTPWepresponse etc but can't get a result. -Jerry Dim URI As String = "HTTP://192.168.0.200/get?brightness"
Dim wbClient As New WebClient Dim strData As Stream = wbClient.OpenRead(URI) Dim sr As StreamReader = New StreamReader(strData) the return data is now in the streamreader ( use the sr `s methods to retreive the data in the desired format ) note that you need to set up a proxy object and bind this to the webclient if you are behind a proxy server regards Michel Posseth [MCP] Show quoteHide quote "Jerry Spence1" wrote: > The following seemed so easy in VB6 > > Inet2.URL = HTTP://192.168.0.200/get?brightness > > Dim retval As String = AxInet2.OpenURL > > > This would give me the string 'Brightness=34' (It's from a camera) > > How do I do it with VB.Net (2005)? I've trawled through loads of code using > Webrowsers, HTTPWepresponse etc but can't get a result. > > -Jerry > > > "can't get a result". Do you mean you have an error or that you just don't
get any response ? Seeing some code could help. System.Net.WebClient is likely the easiest path for now. For example : Dim w As New System.Net.WebClient MsgBox(w.DownloadString("http://www.google.com/")) w.Dispose() Is the target page under your control ? For example a site could perhaps return nothing at all if the user agant is empty... --- Patrice "Jerry Spence1" <jerry.spe***@somewhere.com> a écrit dans le message de news: 44b4ecb0$0$22087$ed261***@ptn-nntp-reader01.plus.net...Show quoteHide quote > The following seemed so easy in VB6 > > Inet2.URL = HTTP://192.168.0.200/get?brightness > > Dim retval As String = AxInet2.OpenURL > > > This would give me the string 'Brightness=34' (It's from a camera) > > How do I do it with VB.Net (2005)? I've trawled through loads of code > using Webrowsers, HTTPWepresponse etc but can't get a result. > > -Jerry > > "Jerry Spence1" <jerry.spe***@somewhere.com> schrieb: <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile>> Inet2.URL = HTTP://192.168.0.200/get?brightness > > Dim retval As String = AxInet2.OpenURL > > > This would give me the string 'Brightness=34' (It's from a camera) > > How do I do it with VB.Net (2005)? I've trawled through loads of code > using Webrowsers, HTTPWepresponse etc but can't get a result. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Ah - that's perfect. Thank you very much
-Jerry Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:ez3E4RbpGHA.5104@TK2MSFTNGP04.phx.gbl... > "Jerry Spence1" <jerry.spe***@somewhere.com> schrieb: >> Inet2.URL = HTTP://192.168.0.200/get?brightness >> >> Dim retval As String = AxInet2.OpenURL >> >> >> This would give me the string 'Brightness=34' (It's from a camera) >> >> How do I do it with VB.Net (2005)? I've trawled through loads of code >> using Webrowsers, HTTPWepresponse etc but can't get a result. > > <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile> > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||