Getting web file content from url with asp.net
Here's how you could get page or file content with help of webclient class and use it for exaple to get the forex rates or regional weather forecast from diferent page and show it to yours:
First we need to import the requred name spaces:
Imports
System.NetImports System.IO
Second there we go with our method:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim client As New WebClientDim sr As StreamReader = New StreamReader(client.OpenRead("http://www.snb-bg.com/test.txt"), System.Text.Encoding.Default(), False) Dim sb As New StringBuilderDo While sr.Peek >= 0sb.Append(sr.ReadLine())
LoopLabel1.Text = sb.ToString()
client.Dispose()
sr.Dispose()
sr.Close()
End SubI think this example is quite easy and don't need more explanation, but in case you need please feel free to send me feedback.
Regards