我用于按钮的代码
protected void btn_backup_Click(object sender, EventArgs e)
{
try
{
Class_Backup objbackup = new Class_Backup();
objbackup.BackUpPath = "SalvageManager" + DateTime.Now.ToString().Replace("/", "_").Replace(":", "_").Replace("-","_").Replace(" ","_");
objbackup.BackupData();
if (objbackup.OperationStatus != false)
{
Response.ContentType = "application/bak";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + objbackup.BackUpPath);
Response.TransmitFile(Server.MapPath("~/DataBaseBackUp/" + objbackup.BackUpPath));
Response.End();
//Response.Redirect(Server.MapPath("~/DataBaseBackUp/" + objbackup.BackUpPath),false);
}
else
{
lbl_message.Text = objbackup.ErrorMessage;
}
}
catch(Exception ex)
{
lbl_message.Text = ex.Message;
}
}
当我单击按钮时发生以下错误
错误:无法打开备份设备“D:\INETPUB\VHOSTS\salvagemanagers.com\httpdocs\DataBaseBackUp\SalvageManager8_19_2013_12_18_01_PM”。操作系统错误3(系统找不到指定的路径。)。BACKUP DATABASE 异常终止。