Click here to Skip to main content
12,746,668 members (31,144 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

7.7K views
Posted 27 Feb 2012

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 JBHworks
United States United States
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 5 Pin
kirahvi18-Dec-12 0:10
memberkirahvi18-Dec-12 0:10 
GeneralReason for my vote of 3 nice and simple. Pin
Dean Oliver27-Feb-12 7:08
memberDean Oliver27-Feb-12 7:08 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170215.1 | Last Updated 26 Feb 2012
Article Copyright 2012 by FrostedSyntax
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid