Reading content of http page

  • Thread starter Thread starter Neven Klofutar
  • Start date Start date
N

Neven Klofutar

Hi,

Is there a way I can read content of http page ?

This won't work:
****************************
string strStranica = @"http://www.hnb.hr/tecajn/hvazeca.htm";
StreamReader sr = new StreamReader(strStranica, Encoding.ASCII);
while ( (strLinija = sr.ReadLine()) != null ) {
....

I get an error:
Exception Details: System.ArgumentException: URI formats are not supported.


Please help, Neven
 
Jonas said:
You should use the HttpRequest[1] class from the System.Web namespace.

No, you cannot. It's a serverside class that you cannot even
instantiate. Use Sytem.Net.WebRequest or System.Net.WebClient.

Cheers,
 
Back
Top