Ok, I finished this, as it stands now, it is basically plug into your site and it will work. What this is is a .asp.net page from which you can request on demand backups of your site.
"Out of the box" functionality it does incremental backups, but that could easily be changed with some coding. There is a simple logger. The one thing it is missing is ftp progress information back to the user, I don't know how to do that though. :( If anyone can help I'd really appreciate it.
Hopefully this will be helpful, I'm not a .net developer by trade, so the code may be a little rough, but hopefully it will work.
Please let me know if you have any questions or suggestions. I'm pretty please with how this thing turned out.
There are 4 files you'll need for this, here is a link to the .zip where you can download them.
http://www.hrs-tech.com/asp.net.backup.zip (test domain which should be functional for a while, I may move the files later, I'll update this post if I do)
I think this should be easy enough to disect and take out parts that you need if people don't want to use the entire thing.
Testing this I was able to zip up my 1.5GB website into about 1GB of space and FTP it to a remote ftp host
And here's a simple asp.net code.
<%@ Page Language="VB" validateRequest=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.HttpUtility" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="EnterpriseDT.Net.Ftp" %>
<script runat="server">
' This could easily be put into your web.config or somewhere else, but it's
' hard coded for now.
Dim ftpHost as String = "ftp.yoursite.com"
Dim ftpPort as Integer = 21
Dim ftpUser as String = "username"
Dim ftpPassword as String = "userpassword"
' This is the remote directory you want to store the .zip file in.
Dim ftpBackupDirectory as String = "./backups"
Sub Page_Load()
' Check to see if the page was posted back.
If Page.IsPostback Then
Dim FtpConnection1 As EnterpriseDT.Net.Ftp.FTPConnection
Try
' Start our ftp Connection things.
FtpConnection1 = New EnterpriseDT.Net.Ftp.FTPConnection()
' Set our properties.
FtpConnection1.AutoLogin = True
FtpConnection1.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
FtpConnection1.DeleteOnFailure = True
FtpConnection1.EventsEnabled = True
FtpConnection1.ParsingCulture = New System.Globalization.CultureInfo("")
FtpConnection1.Password = Nothing
FtpConnection1.ServerAddress = Nothing
FtpConnection1.ServerPort = 21
FtpConnection1.StrictReturnCodes = True
FtpConnection1.Timeout = 0
FtpConnection1.TransferBufferSize = 4096
FtpConnection1.TransferNotifyInterval = CType(4096, Long)
FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.Binary
' Set server and log-in properties
FtpConnection1.ServerAddress = ftpHost
FtpConnection1.ServerPort = ftpPort
FtpConnection1.UserName = ftpUser
FtpConnection1.Password = ftpPassword
' Connect
FtpConnection1.Connect()
' Change to our backup directory.
FtpConnection1.ChangeWorkingDirectory (ftpBackupDirectory)
' ftp the file and close the connection
moveFile(FtpConnection1)
FtpConnection1.Close()
Response.write("file moved")
Catch ex As Exception
' Pretty lame error handling.
' Closes anything we've got open and displays the error.
If FtpConnection1 Is Nothing = true Then
' No need to close anything.
Else
If FtpConnection1.IsConnected Then
FtpConnection1.Close()
End If
End If
Response.write("Error: " & ex.Message)
End Try
End If
End Sub
protected function moveFile(ftpCon as FTPConnection)
' Tack on the date to the file name so we don't overwrite our last backup.
' I'm figuring that the user can decide when it's time to delete their old archives.
Dim strFileLoc as String = Server.MapPath(txtLoc.Text)
Dim ftpFile As New FileInfo(strFileLoc)
ftpCon.UploadFile(ftpFile.ToString, txtName.Text)
End Function
</script>
<html>
<head>
<title>File Backup</title>
<meta id="metaRefresh" runat="server" />
</head>
<body bgcolor="#FFC77F">
<form runat="server" id="frmMain">
<center>
<table width="900" border="0" bgcolor="#8B9BBA">
<tr>
<td colspan="2"><center><font size="+1"><b>Site Administrative Single File Backup</b></font></center></td>
</tr>
<tr>
<td width="300"><b>File Location</b> (please enter relative path from where this file is located. ex: ../page.html)</td>
<td width="600"><asp:textBox id="txtLoc" runat="server" /></td>
</tr>
<tr>
<td width="300"><b>File Remote Name</b></td>
<td width="600"><asp:textBox id="txtName" runat="server" /></td>
</tr>
<tr>
<td width="300"><b>Begin Backup:</b> </td>
<td width="600"><asp:Button id="DeployButton" Text="Backup" runat="server"