I’m working on an application (ASP.NET, Webforms) that generates a list of outputs based on a user input. I want to allow the user to save the contents of said list as text file, or possibly as other filetypes such as .csv. What is the best way to approach this? Can it be done client-side with Javascript?
I’m working on an application (ASP.NET, Webforms) that generates a list of outputs based
Share
I think you will need to use
ActiveXorJava AppletsorSilverlightto do something like that. JavaScript does not have access to local file system.Another way to go with this is create a file on server (physically or on the fly) and make it available for download to the user. That will get him the save file dialog.
To do this on the fly, create a blank page (without any markup. not even ), set
Response.ContentType = 'text/plain'and useResponse.Write()to write your content inPage_Load.