【发布时间】:2014-06-05 15:54:01
【问题描述】:
我们被要求通过 url 从我们的客户网站下载订单文件。 我想做这样的事情。
string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
// Create a new WebClient instance.
using (WebClient myWebClient = new WebClient())
{
myStringWebResource = remoteUri + fileName;
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource, fileName);
}
但是 URL 将是可变的,因为我们必须在我们发布的 URL 中指定日期和时间。
而且我们下载的文件也是可变的。
由于我是 C# 的新手,我想就如何实现这一点提出一些建议?
提前致谢
【问题讨论】:
-
你说 URL/File 是可变的,基于什么?你有一个可能的 URL 的例子吗?我看不出问题出在哪里?您不确定如何根据日期和时间构造 URL?