• 0

Close HttpWebRequest in C#


Question

Hi,

I am trying to close an HttpWebRequest I requested.

However, Close() could take a very long time to return.

Does anyone know why and how to solve this?

Is there a way I can set a timeout on the Close()?

Here's the code:

HttpWebRequest req

= (HttpWebRequest)WebRequest.Create(pageAddress);

req.Timeout=1000;

HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

.

.

.

resp.Close();

thanks a lot!

:)

Link to comment
https://www.neowin.net/forum/topic/160833-close-httpwebrequest-in-c/
Share on other sites

6 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • As Total War turns 25, Creative Assembly is teasing a "new era" for the strategy franchise by Pulasthi Ariyasinghe Creative Assembly has now officially been making Total War games for 25 years. It was in June 2000 that the UK-based studio put forth Shogun: Total War for PC, with Electronic Arts publishing the ambitious project. With a quarter of a century now behind the series, the developer is now looking towards the "next era" of Total War. The studio will host its first-ever Total War showcase in December 2025, which is described as a "flagship video presentation unveiling what’s next for the franchise." Creative Assembly said that the showcase will have announcements for new games as well as content for existing titles, with developer commentary also happening regarding the future of the series. "We’re honoured and humbled to be one of the few video games that get the chance to celebrate such a huge milestone, and we want to thank colleagues past and present, as well as our fans for all the support," says Total War vice president Roger Collum. "2025 marks an exciting new era for the franchise as we reveal what’s next for Total War, and we can’t wait to celebrate throughout the year with everyone." Read an anniversary letter from Roger Collum regarding the studio's history, Total War beginnings, and more over here. Prior to the showcase, Creative Assembly will be hosting retrospective video interviews, developer livestreams, and more behind-the-scenes content regarding the series starting this August. There will also be multiplayer tournaments for fans, giveaways, Q&A sessions with developers, mod spotlights, and more events happening during this period. As the studio celebrates the occasion, a massive Total War historical games sale has just gone live on Steam. This has discounts of up to 75% across everything from the original Shogun: Total War to the latest entry, Total War: PHARAOH. The discounts will last until June 26.
    • ANY standard Windows PC, either desktop or laptop, can install the Copilot app, period, no NPU or Copilot+ certification required. I should know, I have it running on a 3770K (2011) Windows 11 PC and works perfectly fine. So, your laptop can definitely run it, too.
    • Just what the driving public does not need--still another very attractive and addictive distraction.
    • You think Musk fixed any of that? Wow.
    • No, my laptop really, truly does not meet the specs for Copilot, which is no doubt why it was never installed. So there's no problem here to solve.
  • Recent Achievements

    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
    • One Year In
      Orpheus13 earned a badge
      One Year In
    • One Month Later
      Orpheus13 earned a badge
      One Month Later
    • Week One Done
      Orpheus13 earned a badge
      Week One Done
    • Week One Done
      serfegyed earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      539
    2. 2
      ATLien_0
      258
    3. 3
      +FloatingFatMan
      179
    4. 4
      +Edouard
      166
    5. 5
      Xenon
      118
  • Tell a friend

    Love Neowin? Tell a friend!