本文介绍了如何在asp中打开另存为对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp中打开另存为对话框
how to open save as dialog box in asp
推荐答案我进行了搜索,并在互联网上找到了一些资源. ASP.NET/C#提示保存对话框以下载文件 [ ^ ]对您应该有用. 此 [ ^ ]是另一个很好的资源. I did a search and found some resources on the internet. ASP.NET/C# Prompt a Save Dialog Box to Download a File[^] should be useful to you. This[^] is another good resource.
如果这确实是ASP.NET,即基于Web的程序,则您不能这样做,不是您的意思.如果要打开服务器文件系统的另存为,则可以打开OpenFileDialog,但它将出现在服务器上,而不是客户端上.如果这与将文件下载到客户端并在客户端结束时强制执行保存对话框有关,则您也无法执行此操作-下载是在浏览器的控制下进行的,仅由下载者决定是否保存对话框 If this really is ASP.NET, - i.e. a web site based program - then you can''t, not in the way you mean. If you want to open a save as for the server file system, then you can open a OpenFileDialog, but it will appear on the Server, not the Client. If this is to do with downloading a file to the client and forcing a save dialog at his end, you can''t do that either - the download is under the control of the browser and it and it alone decides if a save dialog is needed.
String FileName = "FileName.txt"; String FilePath = "C:/...."; //Replace this System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.Clear(); response.ContentType = "text/plain"; response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";"); response.TransmitFile(FilePath); response.Flush(); response.End();
更多推荐
如何在asp.net中打开另存为对话框
发布评论