Load html (Newbie)

A

Adriano

Hello,

I need to load an HTML code of a remote page in a string variable, using VS
2003 and VB.NET.
Can someone tell me a way I can do that?

thanks in advance!

Adriano
 
K

kimiraikkonen

Hello,

I need to load an HTML code of a remote page in a string variable, using VS
2003 and VB.NET.
Can someone tell me a way I can do that?

thanks in advance!

Adriano

Hi Adriano,
You'd better explaing what you want to do, but i assume this will help
you to find out:
Dim web As New System.Net.WebClient
web.DownloadString("http://www.google.com").ToString

which receives the whole HTML(plus scripts) code in string type.

Hope this helps,

Onur Güzel
 
A

Adriano

Hello Onur,

thanks for reply, I just want to load some HTML tags to textbox.
What your code will look like if I use HTTP proxy with authentication?

thanks in advance!

Adriano

Hello,

I need to load an HTML code of a remote page in a string variable, using
VS
2003 and VB.NET.
Can someone tell me a way I can do that?

thanks in advance!

Adriano

Hi Adriano,
You'd better explaing what you want to do, but i assume this will help
you to find out:
Dim web As New System.Net.WebClient
web.DownloadString("http://www.google.com").ToString

which receives the whole HTML(plus scripts) code in string type.

Hope this helps,

Onur Güzel
 
K

kimiraikkonen

Hello Onur,

thanks for reply, I just want to load some HTML tags to textbox.
What your code will look like if I use HTTP proxy with authentication?

thanks in advance!

Adriano







Hi Adriano,
You'd better explaing what you want to do, but i assume this will help
you to find out:
Dim web As New System.Net.WebClient
web.DownloadString("http://www.google.com").ToString

which receives the whole HTML(plus scripts) code in string type.

Hope this helps,

Onur Güzel

You can even set "Credentials" property and you can also set "Proxy"
property which are the members of "System.Net.WebClient" class.
 
K

kimiraikkonen

You can even set "Credentials" property and you can also set "Proxy"
property which are the members of "System.Net.WebClient" class.

I want to make an addition that maybe useful for the people who are
looking for similar help same with Adriano:

To use "Credentials" property of WebClient class you must define
credentials on "System.Net.NetworkCredential".

' Define credentials in NetworkCredential class
Dim credentials_my As New Net.NetworkCredential
credentials_my.UserName = "username_here"
credentials_my.Password = "password_here"

' Then use defined credentials on your WebClient's Credentials
Dim web As New System.Net.WebClient
web.Credentials = credentials_my
web.DownloadString("http://URL_here")

Regards,

Onur Güzel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top