Vb.net应用程序(Visual Studio 2010) [英] Vb.net application(Visual studio 2010)

查看:106
本文介绍了Vb.net应用程序(Visual Studio 2010)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请让我知道在vb.net应用程序中处理此问题的代码(visual studio 2010)



添加命令行参数ABCGET。因此可以将exe安排为下载文件的作业。只有在命令行参数存在时才会进行下载。

Please let me know the code to handle this in vb.net application(visual studio 2010)

Add a command line argument ABCGET. So the exe can be scheduled as a job to download the files. The download should take place only when the command line argument exists.

推荐答案

请参阅我的易用命令行解析库:基于枚举的命令行实用程序 [ ^ ]。



我推荐另一个在我上面引用的文章中发布在CodeProject上。如果您不想使用我的或任何其他库,您可以简单地阅读一切是如何工作的。我的文章详细解释了它。



如何下载文件?这取决于协议。对于HTTP,您可以使用类 System.Net.HttpWebRequest ,用于FTP - System.Net.FtpWebRequest 。还有一个简化的类 System.Net.WebClient 。请参阅:

https ://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx [ ^ ],

< a href =https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.110%29.aspx> https://msdn.microsoft.com/en-us /library/system.net.ftpwebrequest%28v=vs.110%29.aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.net.webclient%28v=vs .110%29.aspx [ ^ ] 。



有关完整示例,您可以看到我的完整HttpDownloader应用程序的完整源代码,除其他外,它可以完成部分下载下载文件,如果下载过程在任何地方中断。请参阅:如何从互联网上下载文件 [ ^ ]。



另见我过去的答案:

如何从Asp.net 2.0中的服务器下载文件 [ ^ ],

FTP:下载文件 [ ^ ]。



-SA
Please see my easy to use command line parsing library: Enumeration-based Command Line Utility[^].

I recommend another one published on CodeProject in my article referenced above. If you don't want to use my or any other library, you can simply read how everything works. My article explains it in detail.

How to download files? It depends on protocol. For HTTP, you can use the class System.Net.HttpWebRequest, for FTP — System.Net.FtpWebRequest. There is also a simplified class System.Net.WebClient. Please see:
https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.webclient%28v=vs.110%29.aspx[^].

For a complete example, you can see the full source code of my complete HttpDownloader application, which is, among other things, is capable of completion of downloading of partially downloaded files, if download process was interrupted at any place. Please see: how to download a file from internet[^].

See also my past answers:
how to download a file from the server in Asp.net 2.0[^],
FTP: Download Files[^].

—SA


这篇关于Vb.net应用程序(Visual Studio 2010)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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