如何在asp.net中打开另存为对话框

编程入门 行业动态 更新时间:2024-10-26 10:36:35
本文介绍了如何在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中打开另存为对话框

本文发布于:2023-07-27 03:07:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:另存为   对话框   如何在   net   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!