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

  • Home
  • SEARCH
  • 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 6171833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:17:10+00:00 2026-05-23T23:17:10+00:00

Earlier I made an HttpWebRequest that worked perfectly fine, and my StreamReader read the

  • 0

Earlier I made an HttpWebRequest that worked perfectly fine, and my StreamReader read the HTML of the website perfectly.

But all of the sudden, after having tested it’s functionality and confirmed that it worked many times, it hangs the program when it comes to the StreamReader line.
I have tried removing this line, and the code continued.

The thing is; I tried inputting a different website than the one I need to use, (I put in http://www.google.com) and it worked perfectly fine. So my error conclusion is, that it is only the website I need to use that I can’t access anymore which makes me think that the endpart (the website) is cancelling my connection or blocking me or something. BUT! The HttpWebRequest itself doesn’t hang or anything, which must mean that it successfully established a request to the website?

Enough chit-chat, here’s the code:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("website here");
MessageBox.Show("1"); //This is shown.
string HTMLLink = (new     StreamReader(request.GetResponse().GetResponseStream())).ReadToEnd(); //This is where the     program hangs....
MessageBox.Show("2"); //This is not shown! Below this isn't being executed.
if (HTMLLink.Length > 0)
{
    HTMLLink = HTMLLink.Substring(HTMLLink.IndexOf("uuu"), HTMLLink.Length -     HTMLLink.IndexOf("uuu"));
    HTMLLink = HTMLLink.Substring(0, HTMLLink.IndexOf("\" TARGET="));
    request = (HttpWebRequest)WebRequest.Create(HTMLLink);
    string HTML = (new     StreamReader(request.GetResponse().GetResponseStream())).ReadToEnd();
    if (HTML.Length > 0 && HTML.Contains(" </script><br><br><br>") && HTML.Contains("    <br><br><script "))
    {
        HTML = HTML.Substring(HTML.IndexOf(" </script><br><br><br>") + 22,     HTML.IndexOf("<br><br><script "));
        HTML = HTML.Substring(0, HTML.IndexOf("<br><br><script "));
        HTML = HTML.Replace("\r\n", "");
        HTML = HTML.Replace("\n", "");
        HTML = HTML.Replace("<br>", "\r\n");
        HTML = HTML.Replace("<BR>", "\r\n");
        HTML = HTML.Replace("<br />", "\r\n");
        HTML = HTML.Replace("<BR />", "\r\n");
        textBox.Text = HTML;
    }
}

And please keep in mind that it worked perfectly earlier then all of the sudden it started hanging, and that it works fine with http://www.google.com.

And by the way, yes I have done many searches. No useful results.

I have tried the timeout already, it does timeout.
Maybe the website has blocked my program thinking it’s a spider? what then?

Everytime when I reach the StreamReader (no matter how I set it up) it starts to hang.
And it keeps hanging, it doesn’t deliver any result.
This ONLY happens with lyrics007.com which is the exact website I need. It works fine with google.

Help, please!

Thanks in advance!

  • 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-05-23T23:17:11+00:00Added an answer on May 23, 2026 at 11:17 pm

    WebRequest.GetResponse() is a blocking call. It will wait until it can successfully connect and receive the response before it returns control to the caller, or will throw an exception if unsuccessful. This behaviour can’t be modified.

    You usually don’t want your application to sit waiting for something to happen though, so you usually delegate the GetResponse() call to another thread, so you can continue doing other work in the current thread.

    The usual way to overcome this problem is to call asynchronously. Rather than a call to GetResponse, you will call BeginGetResponse(), passing in a function which should be executed when the operation completes (eg, containing the remainder of your current method, plus a call to EndGetResponse()). Control of execution can be passed back to the caller whilst the response is being waited for in a background thread, handled for you automatically by the .NET threadpool.

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

Sidebar

Related Questions

I've made a LocalNotification app and all is working fine, after setting up the
i have a container box that includes a number of thumbnails. i earlier made
I made the following function in SQL Server 2008 earlier this week that takes
Following up from the question I made earlier, I made the query below but
Thanks all for the suggestion made for my earlier query regarding to the getlist
I made this program that should flood fill the matrix but something went wrong.
I made another post earlier about this subject but I've since changed my code
I posted a thread about this earlier and have made some progress but now
Sorry if there is already made such question earlier, but I have no time
I was thinking about this earlier and figured I'd ask. If I made an

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.