Download all type of file in mvc

Download all type of file in mvc

download all type of file in mvc

Learn to download a file in Spring MVC application and prevent cross referencing. Use the void return type for your request-handling method and add To disallow all download requests, coming from other domains, you can check if the. NET MVC3 provides an easy to use abstraction for downloading files in an ASP. They had a file server, hosting various types of reports and were Every action method from the controller class returns an ActionResult. Downloads the resource with the specified URI to a local file. a relative URI that is combined with BaseAddress to form the absolute URI of the requested data.

Download all type of file in mvc - sounds

Download file of any type in Asp.Net MVC using FileResult?

I've had it suggested to me that I should use FileResult to allow users to download files from my Asp.Net MVC application. But the only examples of this I can find always has to do with image files (specifying content type image/jpeg).

But what if I can't know the file type? I want users to be able to download pretty much any file from the filearea of my site.

I had read one method of doing this (see a previous post for the code), that actually works fine, except for one thing: the name of the file that comes up in the Save As dialog is concatenated from the file path with underscores (folder_folder_file.ext). Also, it seems people think I should return a FileResult instead of using this custom class that I had found BinaryContentResult.

Anyone know the "correct" way of doing such a download in MVC?

EDIT: I got the answer (below), but just thought I should post the full working code if someone else is interested:

Источник: [https://torrent-igruha.org/3551-portal.html]
download all type of file in mvc

Download all type of file in mvc

1 thoughts to “Download all type of file in mvc”

Leave a Reply

Your email address will not be published. Required fields are marked *