【发布时间】:2014-03-21 12:45:07
【问题描述】:
将以下网址粘贴到您的浏览器中,您可以下载一个 zip 文件,其中包含航海河图和沿河存在的一些桥梁示意图。
http://ienccloud.us/ienc/web/iencu37productsdownload.cfm?mode=0660&cell=U37AR126
但是,以下代码无法下载 zip 文件:
using (WebClient wc = new WebClient())
{
wc.DownloadFile(@"http://ienccloud.us/ienc/web/iencu37productsdownload.cfm?mode=0660&cell=U37AR126", "download.zip");
}
而是下载以下纯文本 (html) 文件:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Domain Names, Web Hosting and Online Marketing Services | Network Solutions</title>
<meta name="description" content="Find domain names, web hosting and online marketing for your website -- all in one place. Network Solutions helps businesses get online and grow online with domain name registration, web hosting and innovative online marketing services.">
<meta name="keywords" content="domain names, domain registration, web hosting, website host, hosting services, online marketing, network solutions, networksolutions.com, netsol">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
<link rel="meta" href="http://www.https//www.networksolutions.com/labels.rdf" type="application/rdf+xml" title="ICRA labels" />
<meta http-equiv="pics-Label" content='(pics-1.1 "http://www.icra.org/pics/vocabularyv03/" l gen true for "http://https//www.networksolutions.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1) gen true for "http://www.https//www.networksolutions.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1))' />
<meta name="robots" content="noodp, noydir">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" media="screen" href="css/ns.css" />
<script type="text/javascript" src="js/ns.js" ></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/template.css" />
</head>
<body>
<div id="wrapper" class="page">
<div id="content">
<div class="container"></div>
<div class="container">
<div class="box first lrg news">
<div id="productDetails" class="newsMain">
<div class="tagline-container">
<div class="tagline">Welcome to Network Solutions</div>
<p><a href="http://www.networksolutions.com">Go to Network Solutions</a></p>
</div>
</div>
<div class="clr"></div>
</div>
</div>
</div>
</div>
</body>
</html>
我的理解是 URL 是一个重定向,实际的根托管是 AWS。看起来重定向的某些部分出现问题,我不知道如何纠正它。
【问题讨论】:
标签: c# amazon-web-services http-redirect webclient