如何将数据库备份文件从服务器保存到asp.net中的客户端系统? [英] how to save db backup file from server to client system in asp.net?

查看:83
本文介绍了如何将数据库备份文件从服务器保存到asp.net中的客户端系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net网页上,如果用户单击按钮,它将从服务器获取db备份并将其存储在他们的系统上(从服务器到客户端系统).我已经编写了用于获取db备份的存储过程.现在,我不知道如何从服务器将备份文件(dbbackup.bak)保存在客户端系统中?

请指导我的朋友.....

解决方案

  string  FilePath = Server.MapPath(" )+ "  \\ dbbackup.bak";
        Response.ContentType = " ;
        Response.AppendHeader(" " 附件; filename = dbbackup.bak");
        Response.TransmitFile(FilePath);
        Response.End(); 



试试这个可能有帮助...


查看我的 [ 解决方案

string FilePath = Server.MapPath("") + "\\dbbackup.bak";
        Response.ContentType = "image/jpeg";
        Response.AppendHeader("Content-Disposition", "attachment; filename=dbbackup.bak");
        Response.TransmitFile(FilePath);
        Response.End();



Try this may help...


Check out my Solution 2 of ''how to backup sql server 2008 xpres DB to local pc using C#''[^].

It will help you.
Thanks...


In one word, you cannot store any file from server to your client unless you refer the link that contains the .bak file name ( way is to just mention path of file in anchor tag''s ) along with path (provided you saved it in your application path).

But still I think, this is not a good approach from security point of view. As this is a database backup and you definitely need not allow other user to access the file.

Are you using dedicate server or shared hosting?
In either case, the best way is to write a ftp access code in .Net, and save the data from server to your end. This is much secured.

Hope this helps.
cheers


这篇关于如何将数据库备份文件从服务器保存到asp.net中的客户端系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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