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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:38:00+00:00 2026-05-20T19:38:00+00:00

I want to convert a very static DownloadString() call to a DownloadStringAsync() , but

  • 0

I want to convert a very static DownloadString() call to a DownloadStringAsync(), but can’t get the flow as I’d like.

Currently, I do the following in lots of places:

string apiurl = "http://api.gowalla.com/spots/" + spot;
var entries = JsonConvert.DeserializeObject<SpotInfo>(CallGowalla(apiurl));
return entries;

With the CallGowalla looking like so:

private static string CallGowalla(string apiurl)
        {
            var wc = new WebClient();
            wc.Headers["Accept"] = "application/json";
            wc.Headers["ContentType"] = "application/json";
            wc.Headers["Authorization"] = CreateAuthorizationString();
            wc.Headers["-Gowalla-API-Key"] = ConfigurationManager.AppSettings["api"].ToString();
            var raw = wc.DownloadString(apiurl);
            return raw;
        }

I’m getting hangups on the the calls, so I want to move the DownloadString to DownloadStringAsync and I’m not sure where to start without ripping apart all the calls to CallGowalla throughout.

Any ideas?

Suggestions on architecture and refactoring welcome also…

  • 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-20T19:38:01+00:00Added an answer on May 20, 2026 at 7:38 pm

    You probably want to think about how you are calling the CallGowalla() method. It is probably easier to start calling this method in an async manner. Take a look at some of the examples on this Microsoft KB article. Your CallGowalla() method is equivalent to LongRunningMethod() in those samples.

    Running methods asynchronously, perhaps using additional threads, can be problematic in some environments like ASP.NET. It is important to research issues dependent upon your environment. If you are trying to get higher throughput (more calls to Gowalla) then you might want to look into use of the ThreadPool to execute your method without managing threads. The problem with this is that you might exceed the Gowalla API limits very quickly. It would be good if you could provide more detail on why you need to make these calls asynchrously.

    If you need a good overview on threading with C# there is a free book available.

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

Sidebar

Related Questions

i want to convert datetime.now() to ticks, like is the time is 4:00 PM
I want to show icon that associated with file type. Something like this But
I want to convert to my timezone to ireland/Dublin ,currently its taking my system
Very often I want to convert a list wherein each index has identical element
I have a very small number and I want to convert it to a
I want to convert a very simple Antlr grammar to Xtext, so no syntactic
I want to convert POSIX locale names like en_US , de_DE that use ISO-639-1
I want to convert a primitive to a string, and I tried: myInt.toString(); This
I want to convert an instance of generic IDictionary<,> to non generic IDictionary .
I want to convert a string into a double and after doing some math

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.