2013-03-27 22 views
1

嗨,我想顯示一個保存文件對話框在我的asp.net網頁,用戶點擊一個按鈕,並出現一個保存文件對話框,允許用戶保存在他的硬盤圖,如何我可以做嗎?如何顯示一個保存對話框

在服務器保存圖,我用

string AppPath = Server.MapPath(string.Empty); 
DiagramWebControl1.SaveBinary(AppPath + @"\Test.edd"); 

回答

1

你應該做這樣的事情上回發按鈕事件:

 string filepath = AppPath + @"\Test.edd"; 
    HttpContext.Current.Response.ContentType = "application/octet-stream"; 
    HttpContext.Current.Response.AddHeader("Content-Disposition", 
       "attachment; filename=" + "Test.edd"); 
    HttpContext.Current.Response.Clear(); 
    HttpContext.Current.Response.WriteFile(filepath); 
    HttpContext.Current.Response.End();