关于从远程位置获取数据的HTTP请求. [英] Regarding HTTP request to get data from remote location.

查看:81
本文介绍了关于从远程位置获取数据的HTTP请求.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我正在开发Web应用程序.我想连接到远程位置上可用的数据库,并在服务器端获取该信息.我在服务器端有一页,可以在页面加载事件上获取该数据.如何在远程位置上获取这些数据?

任何形式的链接,建议和特别的专家建议都将受到高度赞赏.

谢谢与问候,
Balkrishna Raut

Dear all,

I am working on a web application. I want to connect to the database available on remote location and fetch that information on the server side. I have one page at server side on which I can get that data on page load event. How can I get that data available on the remote location?

Any kind of link, suggestion and specially expert advice would be highly appreciated.

Thanks & Regards,
Balkrishna Raut

推荐答案

If the remote page is already displaying the data, you can examine the html content of the remote page. Now identify the html elements that are around the content.  For example, the records maybe contained in a <div> or <table> element.

With AJAX, you can download the html from this remote page. The next step will be to parse the html content to extract the data that you are looking for.

I hope it helps


您可能希望Web应用程序中的网页以XML格式写入数据:
创建一个新的WebForm

在Load事件中,输入以下代码:

You may want a webpage within your web application that writes the data in XML format :
Create a new WebForm

In the Load event put the following code :

string responseXml = CreateXmlFromDatabase();
Response.ContentType = "text/xml";
Response.Write(responseXml);
Response.End();



当然,还要创建一个函数CreateXmlFromDatabase(),该函数返回要作为字符串传递的数据:



And ofcourse create a function CreateXmlFromDatabase() which returns the data you want to pass as a string :

private string CreateXmlFromDatabase()
{
  StringBuilder sbXml = new StringBuilder("");
  sbXml.Append("<mydata>");

  // Add more XML here that contains data from your database

  sbXml.Append("</mydata>");
}


这篇关于关于从远程位置获取数据的HTTP请求.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆