How to create a fast webrequest ?

  • Thread starter Thread starter thomasabcd
  • Start date Start date
T

thomasabcd

Hi,

During the user's registration I wan't to geo-code an address using
localsearchmaps.com/geo. For that purpose I use a webrequest like this:

string url = "http://www.localsearchmaps.com/geo/?street=" +
StreetNumber + "+" + StreetName + "&city=" + City +
"&country=DK&google2=1";

System.Net.WebRequest webRequest =
System.Net.HttpWebRequest.Create(url);
webRequest.Timeout = webRequest.Timeout * 10;
System.Net.WebResponse webResponse = webRequest.GetResponse();
System.IO.StreamReader reader = new
System.IO.StreamReader(webResponse.GetResponseStream());
string html = reader.ReadToEnd();
reader.Close();

I then pull out the information I need from the html-string.The problem
is, that it sometimes is a bit slow to request the information from the
Internet, and the user is therefore kept waiting. Is there a faster way
to do get the info from the net? Maybe an asynchronous call of some
sort?

TIA
 
I then pull out the information I need from the html-string.The problem
is, that it sometimes is a bit slow to request the information from the
Internet, and the user is therefore kept waiting. Is there a faster way
to do get the info from the net? Maybe an asynchronous call of some
sort?

Do you need the information right away?

Perhaps consider doing an Ajax call instead of a postback.
 
Thus wrote Spam,
Do you need the information right away?

Perhaps consider doing an Ajax call instead of a postback.

I doubt a geo code is useful on the client side -- in which ase AJAX isn't
a viable option.

Why not batch the acquisition of these codes and perform them at some later
point in time?

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top