Display Save File Dialog for a string ASP.NET C#?

有些话、适合烂在心里 提交于 2019-12-31 04:44:09

问题


I am generating a string, which right after generating I want to display a save dialog to allow this to be saved to the user's local machine. I don't want to save it to a file on the server, just have the user save it then clear out the string. Is this possible? I looked at SaveFileDialog but wasn't sure if it would accomplish this. Any help is appreciated, thanks!


回答1:


You need to set certain headers to raise a file dialog box on the client. I think this is what you mean.

See here:

http://support.microsoft.com/kb/260519




回答2:


You cannot show SaveFileDialog in the asp.net code because it is executed on the server side. You can send that generated string to user's browser with HTTP headers indicating that this is an attachment.



来源:https://stackoverflow.com/questions/8215352/display-save-file-dialog-for-a-string-asp-net-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!