Click here to Skip to main content
Click here to Skip to main content

Tagged as

Method for Making a Simple Web Request

, 26 Feb 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
A method for getting the response from a web request made to the specified URL.
A method for getting the response from a web request made to the specified URL:
public static string makeWebRequest(string host)
{
    var request = (HttpWebRequest)WebRequest.Create(new Uri(host));
 
    var response = (HttpWebResponse)request.GetResponse();
 
    Stream dataStream = response.GetResponseStream();
    StreamReader dataread = new StreamReader(dataStream);
    return dataread.ReadToEnd();
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

FrostedSyntax
Web Developer JBH Works
United States United States
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 Pinmemberkirahvi18-Dec-12 0:10 
GeneralReason for my vote of 3 nice and simple. PinmemberDean Oliver27-Feb-12 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 26 Feb 2012
Article Copyright 2012 by FrostedSyntax
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid