vb .net代码,用于在线备份项目的文件夹上传 [英] vb .net code for folder upload for online backup project

查看:86
本文介绍了vb .net代码,用于在线备份项目的文件夹上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是vb.net编程的新手,我需要在线备份源代码来使用vb.net代码(而不是ftp概念)将文件夹从服务器备份到客户端.我使用服务器IP.

I am new to programming in vb.net , i am in need of an online backup source code to backup folders from server to client using vb.net code, not ftp concept. i am using server ip instead.

推荐答案

您必须通过网络或Internet将文件从A点移动到B点.帕特尔先生在问你打算怎么做.

本地网络
如果它是网络位置,则您只需在服务器上注册为用户并使用共享服务器文件夹(即//Server/MyFolder)并使用常规IO功能即可.

服务器在网络上
如果您未本地连接到服务器,则可以访问完全共享的公用文件夹,但其他人也可以.为了解决这个问题,您需要登录要在其中移动文件的计算机.

文件夹的语法与//ServerIP/Myfolder相同,但是您需要传递凭据. .net Framework没有简单的方法可以做到这一点.您将需要使用模拟功能.

这是我用于模拟的链接 http://kellyschronicles.wordpress.com /2008/10/10/impersonate-user-with-vb-net/ [
您可以在网络服务器上执行此操作的另一种方法要简单得多,但效果却不尽如人意,这是将驱动器映射到网络共享文件夹,该文件夹为您处理身份验证.您只需将驱动器号(例如Drive z :)映射到该地址,您的程序就可以访问驱动器Z

要映射驱动器,请右键单击我的电脑"图标,然后选择映射驱动器".然后,选择要使用的驱动器号,输入服务器地址和登录信息.

通过FTP
有一个方便的FTP组件,可以在vb应用程序中使用.

[下载]
该组件是免费的.入门有点麻烦,但是很有效.我用它来将网站信息上传到我的程序中.

Web服务
您甚至可以在本地网络上轻松编写Web服务.此方法非常适合基于Web的外部服务器,尤其是当您想与服务器上运行的程序进行交互时.

我认为这几乎涵盖了最常见的方法.一旦选择了一个,就会更容易了解编码的执行方式.
You have to move files from point A to Point B across a network or internet. Mr. Patel was asking how you plan to do that.

Local Network
If it is a Network Location then you can simply register as a user on the server and use a shared server folder ie //Server/MyFolder and use normal IO functions.

Server On The Web
If you are not connected to a server locally, you can access a completely shared public folder but so could everone else. In order to get around this, you need to log in to the computer you are moving files to and from.

The sytax for the folder is the same //ServerIP/Myfolder but you will need to pass the credentials. There is no easy way with the .net Framework to do this. You will need to use impersonation.

Here is the link I used for Impersonation http://kellyschronicles.wordpress.com/2008/10/10/impersonate-user-with-vb-net/[^]

Server On The Web alternative
The other way you can do this on a webserver that is much easier but not nearly as nice is to map a drive to the network shared folder which handles the authentication for you. You just map a drive letter like Drive z: to the address and your program can access drive Z

To Map a drive you right click on the My Computer icon and select Map Drive. You then select the drive letter you want to use, enter the server address and the login information.

Via FTP
There is a handy component for FTP that you can use in your vb app.

[Download]
This component is free. It is a little cumbersome to get started but ver effective. I use this to upload website information to from my programs.

Web Service
You can easily write web service even for use on your local network. This method is great for webbased external server especially if you want to intereact with the process from a program running on the server.

I think that pretty much covers the most common methods. once you pick one, it will be easier to get down to how the coding is performed.


谢谢您,

但是我试图在vb .net中开发一个Windows应用程序,该应用程序使用ip地址将文件从一个系统传输到另一个系统,并将其保存在server.but但当我尝试备份文件夹时,我没有找到任何解决方案来备份整个文件夹.我搜索了Internet,但找不到代码来将包含文件/子文件夹的文件夹从源转移到目标计算机.

请为我提供使用vb .net代码在服务器和客户端之间传输文件夹的解决方案.
Thank u jim,

but i am trying to develop a windows application in vb .net which uses a ip address to transfer files from one system to another, and saves it in the server.but when i try to take backup of folder, i dont find any solution to backup a folder on a whole. i searched internet but i couldnt find a code to transfer folder having files/subfolder from source to destination machine.

please provide me solution to transfer folders between server and client using vb .net code.


确定.没有一种简单的1命令方法可以复制目录,但您当然可以扫描每个目录并复制每个文件.

这是一个包含复制整个目录的解决方案的页面. http://www.dreamincode .net/forums/topic/154022-how-to-simply-copy-a-directory-and-all-its-contents/ [
Ok.. There is no easy 1 command way to copy a direcory but you can certainly scan each directory and copy each file.

Here is a page with a solution to copy a whole directory. http://www.dreamincode.net/forums/topic/154022-how-to-simply-copy-a-directory-and-all-its-contents/[^]

As far as it being on a server, as long as you have access to the shared folder in which you will be copying to, you should be able to write to it just like you do your harddrive. If you need to athenticate with the server, it may be a little tougher and you can look at my prior comments to find links.


这篇关于vb .net代码,用于在线备份项目的文件夹上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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