I am trying to retrieve a web page, add some text at the top of the page then I will be sending off the string. Here is a example framework of what I am trying to do. Is this the correct method or am I doing a big no-no somewhere?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.example.com");
var responce = (HttpWebResponse)request.GetResponse();
var responseStream = responce.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
string responseString = reader.ReadToEnd();
StringBuilder sb = new StringBuilder(responseString);
var index = sb.ToString().IndexOf("<body>", StringComparison.InvariantCultureIgnoreCase)+"<body>".Length;
sb.Insert(index, "A lot of text will go here.");
Console.WriteLine(sb.ToString());