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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:10:42+00:00 2026-06-09T13:10:42+00:00

We have a situation where we use the WebClient class to download some data

  • 0

We have a situation where we use the WebClient class to download some data from a server. We have control over both the client and server portions. Currently, each time a user does an action, a webclient is generated and used to make a connection to a server. The client then downloads some data in the background and does some work with it. The problem arises when the user causes this to happen repeatedly… On the server side (NOT .net based!) we see that the connection times out after our timeout period and not teardown is ever sent to the server. This brings me to my question…

Is there a proper way to signal or force a teardown of the HTTP connection used by the webclient class?

Code:
pMPTF is a callback class to bring the .net event into the unmanaged world.

void Callback(System::Object^ sender, System::Net::DownloadDataCompletedEventArgs^ e)
{
   WebClient^ w = (WebClient^)sender;
   w->Dispose();
   if( e->Error == nullptr && pMPTF != NULL )
      pMPTF->ParseResponse(e->Result);
   else
      pMPTF->ParseResponse( nullptr );
}

Gives:

error C2039: ‘Dispose’ : is not a member of ‘System::Net::WebClient’

  • 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-09T13:10:43+00:00Added an answer on June 9, 2026 at 1:10 pm

    The operation is completed at that point. If use delete the object will be disposed. I would recommend reading-up on how objects are disposed in managed C++: msdn.microsoft.com/en-us/library/ms177197.aspx

    If you want to manually close the response, you can call GetWebResponse and call the Close on the returned WebResponse object.

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

Sidebar

Related Questions

We have a situation where we want to use filter for URL's containing some
I have a situation where I need to use some strings temporarily but I've
I have a situation in which I need to extract Data Annotations information from
I have a situation where my website needs to quickly retrieve data from my
I have a situation where I want to use several server side controls, which
I have a situation when some clients see the server by its local IP
When should I use multiple class libraries in .NET. I have a situation where
We have a situation in our product where for a long time some data
I have a situation where I need to use both EdgeNGramFilterFactory and NGramFilterFactory. I
I have a situation where I must use Windows API to retrieve text from

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.