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 8140847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:17:59+00:00 2026-06-06T12:17:59+00:00

Possible Duplicate: Adjusting HttpWebRequest Connection Timeout in C# In my code, I am calling

  • 0

Possible Duplicate:
Adjusting HttpWebRequest Connection Timeout in C#

In my code, I am calling a live chat api to get list of operators in the following format:

            HttpWebRequest request
                = WebRequest.Create("url-here") as HttpWebRequest;
            request.Credentials
                = new NetworkCredential(
                    username,
                    password
                    );

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());

           //dowhatever
            }

Today the live chat api went down and because of the our site also went down. In this case the api request went on spinning and was in ‘not responding’ state.

How to fix this? I do not want continue waiting until the api responds. because it will cause my page also go on spinning. Is there way like timeout – or wait for 2 seconds then skip the live chat request part?

Thanks for the help!

  • 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-06T12:18:01+00:00Added an answer on June 6, 2026 at 12:18 pm

    You can use the WebRequest.Timeout property to set how long you’d like your code to wait before timing out:

    var request = WebRequest.Create("url-here") as HttpWebRequest;
    request.Credentials = new NetworkCredential(username, password);
    request.Timeout = 30 * 1000; // wait for 30 seconds (30,000 milliseconds)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Unable to get a list of installed Python modules How do I
Possible Duplicate: How to successfully rewrite old mysql-php code with deprecated mysql_* functions? I
Possible Duplicate: Matlab gives wrong answer Can anyone explain to me why the following
Possible Duplicate: Javascript window resize event I want to get an event which is
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: How can I combine multiple rows into a comma-delimited list in Oracle?
Possible Duplicate: How do I make a list with checkboxes in Java Swing? I
Possible Duplicate: how to use foursquare API in android application? This is a question
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have
Possible Duplicate: How to store an IP in mySQL I want to get the

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.