简体   繁体   中英

Serving a file generated dynamically by the model, in ASP.NET MVC

I'm still new to web app development, so bear with me if this sounds a little silly.

I have to implement functionality into an ASP.NET MVC2 website so that users can download an .rdp file that is generated after clicking a URL.

The reason they need to be generated is that the user names for the machines are shared, but sometimes change, and the users don't necessarily know what they are.

Generating the file would be fine, but my questions are: a) What's the best way of returning the file from my business layer

b) A push in the right direction as to what I need to implement in my controller in order to be able to handle the request, as well as be able to serve up the generated file.

Take a look here for an example:

How can I present a file for download from an MVC controller?

You'd have an ActionResult inside your Controller that would return a File to the user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM