从URL下载数据到本地文件

来源:互联网 发布:php网页设计 编辑:程序博客网 时间:2024/04/28 14:51

http://localhost:3148/test2/Default6.aspx

 

设置
高级

 
请输入URL:

已经下载,请自行检查d:/temp.html
 
登录




新 闻网 页贴 吧知 道MP3图 片视 频

空间  hao123 | 更多>>

把百度设为主页

企业推广 | 搜索风云榜 | 关于百度 | About Baidu

©2009 Baidu 使用百度前必读 京ICP证030173号

 

 

<%@ Import Namespace="System.net" %>
<script language="vb" runat="server">
    Sub enter_click(ByVal sender As Object, ByVal e As EventArgs)
        Dim wc As New WebClient()
        wc.DownloadFile(txtURL.Text, "d:/temp.html")
        message.text="已经下载,请自行检查d:/temp.html"
    End Sub
</script>

 

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    请输入URL:<asp:TextBox ID="txtURL" runat="server" />
    <asp:Button ID="enter" Text ="确定" OnClick ="enter_click" runat="server" />
        <br />
        <br />
    <asp:Label ID="message" runat="server" />   
    </div>
    </form>
</body>
</html>