File is opening in bowser instead of downloading
Firstly, it might be because you offer a really large item. Rather than attempting to finish a page PDF once, readers often break them down and digest each small part at a time. To avoid going online every time viewing that file, they can download it to their device and open it anywhere at any time. Another case is selling digital products such as PDF ebooks or course videos.
Forcing downloads makes sure customers receive what they pay for. Zip files refer to a combination of one or more files that are compressed into a single file for easier transportation and compression.
All you need to do is group your desired files into a folder on your device. You can send this zip file to users via emails or social platforms. Recipients simply click on the file and download it in seconds. They have to double click and expand it to access all media files. You should use the following code and add it to the. In case you want users to click and download multiple different files, just replace the?
Video Hub Azure. Microsoft Business. Microsoft Enterprise. Browse All Community Hubs. Turn on suggestions. Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Showing results for. Show only Search instead for. Did you mean:. Sign In. Frequent Contributor. But now there seems to be no GUI-Option to undo this selection.
Does nobody else has this behaviour? You can let User open the file directly or download it directly without opening it in the browser. If you are already sure about the file extension and you want the user to open the file as a preview then we can use the File or FileContentResult class to decide the behavior. File class can be used directly in the controller method once you obtain the stream or byte array of the required file. FileContentResult class can be used directly in the controller method once you obtain the stream or byte array of the required file.
As we know FileResult is an abstract base class. FileStreamResult — Sends binary content to the response by using a Stream instance. Here you have a stream and want to return stream content as a file. FileContentResult — Sends the contents of a binary file to the response. Here you have a byte array and want to return byte content as a file.