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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:23:13+00:00 2026-05-26T11:23:13+00:00

I use WebClient in a Silverlight Appliction to access REST Services. Its an unknown

  • 0

I use WebClient in a Silverlight Appliction to access REST Services. Its an unknown amount of asynchronous calls.
The cool thing is, you can order your requests and responses! the responses are matched to theirs requests! This is necessary, because you do not know in what order the responses will come back.

But how do i get a “timeout” for my calls with WebClient? lets say 15 sec
I would like kinda to stick to WebClient/this code with delegates/lambda. I know there is a timeout property with WebRequest class, but i am not sure if just can replace WebClient with WebRequest but keep the functionality.

int maxRequests = list_S.Count;
// amount of URI
        foreach (string item in list_S)
        {
            bool isValid = Uri.IsWellFormedUriString(item, UriKind.Absolute);
            Uri uriTest;
            if(isValid) //if it is valid Uri, send request
            {
                WebClient wc = new WebClient();
                wc.DownloadStringCompleted += (s, args) =>
                {
                    if (args.Error == null)
                    {
                        dict.Add((int)args.UserState, args.Result);

                    }
                    //here you test if it is the last request... if it is, you can
                    //order the list and use it as you want 
                    if (dict.Count == maxRequests)
                    {
                        var orderedResults = dict.OrderBy(a => a.Key);
                    }
                    closeTabitem_SensorSource();
                };
                wc.DownloadStringAsync(new Uri(item), i++);
            }
            else
            {
                MessageBox.Show("Uri FAIL!: " + item);
            }
        }
  • 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-26T11:23:14+00:00Added an answer on May 26, 2026 at 11:23 am

    The WebRequest does not provide a means for managing request timeouts either.

    The approach you need to take is to use WebClient in conjunction with your own code based on a DispatcherTimer that will call the WebClient CancelAsync method.

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

Sidebar

Related Questions

Can someone please tell why, when I use WebClient in C# to download a
I'm trying to use the WebClient class to download a html file from another
In an asp.net application, I would like to combine the use of the Webclient
I've got a Silverlight app that talks to a REST web service using the
How can I use HttpWebRequest.BeginGetResponse and get progress changed events for the upload of
Edited my code to use WebClient...still doesnt work string hhtmlurl = /Thumbnail.aspx?productID=23&Firstname=jimmy&lastnight=smith; string strFileName
I'm trying to use WebClient to download a bunch of files asynchronously. From my
Simple question. How can I use .NET to traverse the directory structure of a
In my application I use the WebClient class to download files from a Webserver
I am using an instance of WebClient in my Silverlight application to retrieve 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.