Angular Web API Download File | Complete Tutorial

preview_player
Показать описание
Angular Web API Download File | Complete Tutorial
This video has complete tutorial on downloading file from web api using angular.
Web API Download File .net core have been demoed in this video. It is super easy to download the file in web api. We need to use File method with appropriate content type and byte array of the file and file name to download the file from web api in .net core.
------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
This video has information on converting data table to csv and the same can be downloaded from web api in .net core. In this video, we are reading data table from database and converting that to a csv file and then using Encoding class , we are converting the csv data string to a byte array and using File method to download the file from web api.
---------------------------------------------------------------------------------
In leagacy .net we had to create http response message with file but in .net core Microsoft made it very is to return file from web api. In this video I have used .Net 5 Web API Download File. CSV file is a comma separated file and we have to follow certain rules to return file from web api.
------------------------------------------------------------------------------
When downloading the file from web api, we may face CORS issue and it can be mitigated by adding UseCORS middleware to download file web api. Once you enable the CORS, you can return file web api. This video has tutorial to read file name from web api response itself.
#WebAPIDownloadFile#
#AngularDownloadFile#
#DownloadFileFromWebAPI#
Chapters
00:00 Intro
00:35 - Web API Download File
03:45 - Convert Data table to Csv .net Core
10:42 - Web API Download File Testing using Swagger
11:35 - Angular Download File from Web API
Рекомендации по теме
Комментарии
Автор

Thank you so much!!! Your explains save my day!!....

evertonteco
Автор

Amazing tutorial, thank you so much!!!

valeriamorales
Автор

Good information. My only suggestion is to ask for folks to subscribe at the beginning and end of the video not all throughout the video.

ericfleet
Автор

Is there a way we can only view file and restrict from downloading it

manasatn
Автор

it is perfectly working locally but when i published it on live it is returning me undefined.html

asifsorathiya