XmlHttpRequest from a Windows Application?

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

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
 
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 said:
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
 
Back
Top