Saturday, February 19, 2005

Republish info from a web site

It's really easy in .NET to output your own censored / transformed version of another web page.

Here's a code snippet which reads the contents of one web site, does some changes it, and re-publishes it on your own web site.

Make sure strURL has the "http://" at the front of it, and be sure to take acount of the fact that any relative references in the source web will still be relative in the target web.

Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(strURL)

Dim objResponse As WebResponse = objRequest.GetResponse()

Dim sr As StreamReader = New StreamReader(objResponse.GetResponseStream())

Response.Write(Page, SomeTransformationOf(sr.ReadToEnd()))

No comments: