Possible Duplicate:
event handles & visible
I am new to learning WebRequest.This is my code
WebRequest myRequest;
myRequest = WebRequest.Create("");
WebResponse myResponse = myRequest.GetResponse();
Stream responseStream = myResponse.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
StringBuilder sb = new StringBuilder();
string line = "";
while ((line = reader.ReadLine()) != null)
{
sb.Append(line);
sb.Append("\r\n");
}
textBox1.Text = sb.ToString();
I am having trouble understanding how to allow the user to enter the URL and click the button and that page shows up.Can some help me understand . Where it says
myRquest = WebRequest.Create(“”); when the user enters the URL in the textbox and clicks the go button that it will go to that web page.
Assume that you have a TextBox on your page (txtUrl) that the user uses to type in the Url. Then you would do something like this
That passes the url the user entered into the WebRequest.Create() method. However, you’ll need to add some error checking in case the user does not enter a value, or enters a bad url, etc.