Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:16:55+00:00 2026-06-15T07:16:55+00:00

Im trying to send a get request and get the content of a webpage.

  • 0

Im trying to send a get request and get the content of a webpage. i have these code.

string url = "www.google.com";

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
 HttpWebResponse response = (HttpWebResponse)response.GetResponse();

I found these codes from many site and it is correct but “GetResponse” is giving error. Its explanation below.

Is it a problem of Visual Studio 2012 ? It cant find GetResponse method and just find GetResponseStream method when I press G.

I tried to do this with WebClient class but WebClient cannot be found also.
Do these problems occur because of Visual Studio 2012? or any reason ?

Error 1 ‘System.Net.HttpWebResponse’ does not contain a definition for ‘GetResponse’ and no extension method ‘GetResponse’ accepting a first argument of type ‘System.Net.HttpWebResponse’ could be found (are you missing a using directive or an assembly reference?) C:\Users\abidinberkay1\documents\visual studio 2012\Projects\App1\App1\BlankPage1.xaml.cs 45 66 App1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:16:56+00:00Added an answer on June 15, 2026 at 7:16 am

    You’re calling “response.GetResponse().” It’s request.GetResponse().

    Update: Based on your comments, I’ll propose some new code:

    private async void btnRequest_Click(object sender, EventArgs e)  // Note: async added
    {
        string url = "www.google.com";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync(); // (note: await added, method call changed to GetResponseAsync()
    
    }
    

    I’ve updated your code to use the C# 5.0 async and await pattern. This allows you to easily use asynchronous methods while writing code that feels synchronous. In order to do this, I’ve added the async keyword to the method declaration, prior to the return type (void in this case), and I’ve added the await keyword prior to calling WebRequest.GetResponseAsync().

    To answer your question regarding how to know which library you’re using: in this case, you chose a Windows Store app. You should specifically call out what kind of project you’re working on – it’ll help us nail these kinds of things down faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send a post request to Parse: https://parse.com/docs/rest#objects-creating . Can't get it
I'm trying to send json string in the get request to the server, here
I'm trying to send a HTTP POST request to a Google server and get
I'm trying to send a http get request in a php file to a
I'm trying to send a GET request to a App Engine server from a
While trying to send a POST request via xmlhttp.open(POST, url, true) (javascript) to the
I am trying to send a message through GCM (Google Cloud Messaging). I have
I am trying to send a GET request to a REST server using Java.
I am trying to send a POST request to add some content to an
I am trying to send a json object using GET method. My code: $.ajax({

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.