471,348 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

XmlHttpRequest from a Windows Application?

I want to design/develop an windows application (C#) that can query
multiple
websites (XmlHttpRequest), call number of 3rd party external
webservices (SOAP) and parse/process the data and display it to the
user.

Ideally this would have been developed as a website, but due to crosss
doman limitation on XmlHttpRequest, I am thinking of developing it as
an windows application.

1. from some initial searching, one of the solutions I found is to
build an browser based application (application: with the browser
control). If so can I still use XmlHttpRequest ? and would the
cross-domain limitation with XmlHttpRequest apply here and in any way
prevent me from querying multiple sites ?

2. Is there any other way of doing this.

thanks in advance
dave

Feb 17 '06 #1
1 6614
Why don't get at the HTML via the ResponseStream property of the
HttpWebResponse object?
See sample below

public static string GetHTMLFromURL(string url)
{
if(url.Length == 0)
throw new ArgumentException("Invalid URL","url");

string html = "";
HttpWebRequest request = GenerateGetOrPostRequest(url,"GET",null);
HttpWebResponse response = (HttpWebResponse)request.GetResponse( );
try
{
if(VerifyResponse(response)== ResponseCategories.Success)
{
// get the response stream.
Stream responseStream = response.GetResponseStream( );
// use a stream reader that understands UTF8
StreamReader reader = new
StreamReader(responseStream,Encoding.UTF8);

try
{
html = reader.ReadToEnd( );
}
finally
{
// close the reader
reader.Close( );
}
}
}
finally
{
response.Close( );
}
return html;
}
"dave" wrote:
I want to design/develop an windows application (C#) that can query
multiple
websites (XmlHttpRequest), call number of 3rd party external
webservices (SOAP) and parse/process the data and display it to the
user.
Ideally this would have been developed as a website, but due to crosss
doman limitation on XmlHttpRequest, I am thinking of developing it as
an windows application.
1. from some initial searching, one of the solutions I found is to
build an browser based application (application: with the browser
control). If so can I still use XmlHttpRequest ? and would the
cross-domain limitation with XmlHttpRequest apply here and in any way
prevent me from querying multiple sites ?

2. Is there any other way of doing this.

thanks in advance
dave


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Feb 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Chris Smith | last post: by
5 posts views Thread by Peter Michaux | last post: by
1 post views Thread by geevaa | last post: by
2 posts views Thread by Michael Nemtsev [MVP] | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.