For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > May 2006 > How to create a fast webrequest ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to create a fast webrequest ?
thomasabcd

2006-05-30, 10:03 pm

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

Spam Catcher

2006-05-30, 10:03 pm

"thomasabcd" <dolberg@gmail.com> wrote in news:1149039844.985662.109280
@i39g2000cwa.googlegroups.com:

> 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.
Joerg Jooss

2006-05-31, 7:11 pm

Thus wrote Spam,

> "thomasabcd" <dolberg@gmail.com> wrote in
> news:1149039844.985662.109280 @i39g2000cwa.googlegroups.com:
>
> 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,
--
Joerg Jooss
news-reply@joergjooss.de


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com