using WebClient, how??

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

ASP.NET 2.0

I'm working on a asp.net 2.0 website which needs to access a database on
another server via an request. This database is placed on another server
which is not based on ASP.NET, but traditional ASP. The ASP.NET may access
the database on the other server by requesting a .asp page with some
parameters - and hte output on the .asp page was the result from the
database query... So I need to access a asp page on this other server via an
request as from using an object of the WebClient class. The output from the
..asp page will be returned back to the ASP.NET 2.0 website for processing...

For example like this:
www.test.com\index.asp?user=newbie&pword=insecure
How can I access this page from my ASP.NET 2.0 website by using WebClient?

Or is it a much better approach to install .NET 2.0 on this server and
implement a web service instead (the server is a windows server) so my
ASP.NET 2.9 website can access it by using a webservice instead?

Any suggestions???

Jeff
 
asp has simple webservice support. webclient is simple, but you will
need to parse the response data.


-- bruce (sqlwork.com)
 
ASP.NET 2.0

I'm working on a asp.net 2.0 website which needs to access a database on
another server via an request. This database is placed on another server
which is not based on ASP.NET, but traditional ASP. The ASP.NET may access
the database on the other server by requesting a .asp page with some
parameters - and hte output on the .asp page was the result from the
database query... So I need to access a asp page on this other server via an
request as from using an object of the WebClient class. The output from the
.asp page will be returned back to the ASP.NET 2.0 website for processing...

For example like this:www.test.com\index.asp?user=newbie&pword=insecure
How can I access this page from my ASP.NET 2.0 website by using WebClient?

Or is it a much better approach to install .NET 2.0 on this server and
implement a web service instead (the server is a windows server) so my
ASP.NET 2.9 website can access it by using a webservice instead?

Any suggestions???

Jeff


I think you can use System.Net.HttpWebRequest

for example:

HttpWebRequest request =
(HttpWebRequest)HttpWebRequest.Create("http://...page.asp");
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string asp = reader.ReadToEnd();

Using xml as an output you can easily parse it as per

XmlDocument xml = new XmlDocument();
ResponseXmlDoc.LoadXml(asp);
 
Back
Top