asp.net - 从 ASP.NET 中的 URL 获取数据

标签 asp.net .net string visual-studio-2010 url

我是 asp.net 的新手,

我想从 asp.net 上的 url 获取数据。 & 需要将数据存储到字符串中。

如果假设这是我的 URL,那么我想以字符串形式获取此 URL 数据,

http://www.islamicfinder.org/prayer_service.php?country=bahrain&city=manama&state=02&zipcode=&latitude=26.2361&longitude=50.5831&timezone=3.00&HanfiShafi=1&pmethod=4&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml

最佳答案

试试这个

string url = "http://www.islamicfinder.org/prayer_service.php?country=bahrain&city=manama&state=02&zipcode=&latitude=26.2361&longitude=50.5831&timezone=3.00&HanfiShafi=1&pmethod=4&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml";
            var webClient = new WebClient();
            string data = webClient.DownloadString(url);

关于asp.net - 从 ASP.NET 中的 URL 获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10007349/

相关文章:

.net - 当我发布带有 "Only files needed to run this application"选项的 ASP.NET Web 项目时,为什么没有复制 web.config?

c# - USING 语句的返回值

android - 仅将粗体文本保存到跨字符串中的字符串数组?

r - 如何复制和粘贴带有不平衡引号的字符串?

Java 分割字符串的空部分

c# - 如何按角色进行不同登录 ASP.NET Core 2.2

javascript - Microsoft JScript 运行时错误 : Cannot assign to a function result?

c# - 无法将 NULL 值插入表的列 'ID'

c# - 为什么 List<T>、Dictionary<T> 和其他集合包含一个名为 "version"的字段?

c# - 在远程计算机上创建和删除文件