| 1 | public class Webclient2 |
| 2 | Inherits System.Web.UI.Page |
| 3 | protected WithEvents Literal1 as System.Web.UI.WebControls.Literal |
| 4 | |
| 5 | private Sub Page_Load(ByVal sender as System.object, ByVal e as System.EventArgs) Handles MyBase.Load |
| 6 | Dim wc as new System.Net.WebClient() |
| 7 | Dim s as System.IO.Stream |
| 8 | Dim sr as System.IO.StreamReader |
| 9 | Dim q as new System.Collections.Specialized.NameValueCollection() |
| 10 | |
| 11 | q.Add("text", "test text") |
| 12 | q.Add("password", "secret") |
| 13 | q.Add("checkbox", "on") |
| 14 | q.Add("textarea", "a longer text sentence") |
| 15 | q.Add("submit", "submit") |
| 16 | |
| 17 | wc.QueryString = q |
| 18 | |
| 19 | s = wc.OpenRead("http://authors.aspalliance.com/damianm/article/4/2/formreader.aspx") |
| 20 | |
| 21 | 'read in the page |
| 22 | sr = new System.IO.StreamReader(s) |
| 23 | Literal1.Text = sr.ReadToEnd() |
| 24 | |
| 25 | '--tidy up |
| 26 | sr.Close() |
| 27 | s.Close() |
| 28 | End Sub |
| 29 | |
| 30 | End class |