Had to look this up - again - so writing a quick note for future reference.
public static string Download(string url) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream stream = httpWebResponse.GetResponseStream(); StreamReader streamReader = new StreamReader(stream, Encoding.ASCII); return streamReader.ReadToEnd(); }
Labels: code csharp
January 2007 | March 2007 | May 2007 | February 2008 | April 2008 | July 2008 | September 2008 | October 2008 | December 2008 | January 2009 | April 2009 | May 2009 | June 2009 | December 2009 | January 2010 |
Subscribe to Posts [Atom]