如何在VB.NET中使用url将文件下载到本地pc [英] How to download file using url to local pc in VB.NET

查看:80
本文介绍了如何在VB.NET中使用url将文件下载到本地pc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

If e.CommandName = "Down" Then

    Dim row As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow)
    Dim lblDoc = TryCast(row.FindControl("lbllog"), Label).Text
    Dim cs = "http://172.16.16.21/"
    Dim save = lblDoc.Substring(37)
    Dim savepath = "D:/Documents/"
    If (Not System.IO.Directory.Exists(savepath)) Then
        System.IO.Directory.CreateDirectory(savepath)
    End If

    Dim savetolocalsave = savepath + save
    Dim lblDoca = cs + lblDoc.Substring(16)





    'Dim webClient As New System.Net.WebClient()
    'webClient.DownloadFile(lblDoca, savetolocalsave)





我尝试了什么:



它通过url保存图像..但是它保存了来自哪个服务器的图像来..

不保存在我的本地电脑..我想在我的本地电脑上保存图像..



What I have tried:

it saves image by url..but it saves the image from which server it comes..
not save on my local pc..i want to save image on my local pc..

推荐答案

您无法从Web服务器将文件保存到本地计算机。如果网站可以在本地PC上保存文件,则安全隐患将是巨大的。无论你多少次问这个问题答案总是一样的。
You can't save files to the local machine from a web server. If web sites could save files on your local PC the security implications would be huge. It doesn't matter how many times you ask this question the answer is always going to be the same.


这篇关于如何在VB.NET中使用url将文件下载到本地pc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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