bernas9 Posted November 10, 2015 at 10:17 AM Report Share #589578 Posted November 10, 2015 at 10:17 AM (edited) Boa dia, Malta estou a tentar fazer um download no controller de uma view do evento do botão em MVC, so que o que esta a acontecer é que já tentei mil e uma coisas e nao estou a conseguir pois estou a ir buscar o ficheiro, trata lo todo, quando devia fazer o download nao esta a fazer, alguem me pode dar uma ajudinha? Vou deixar aqui o código que estou a usar, este código esta a ser chamado no evento do botão. public FileResult DownloadFile() { var path = Server.MapPath("~/Content/exportacaoDeDados.zip"); byte[] file = getFile(path); string fileName = "exportacaoDeDados.zip"; return File(file, "application/zip", fileName); } Edited November 10, 2015 at 11:20 AM by apocsantos Link to comment Share on other sites More sharing options...
Solution He B TeMy Posted November 10, 2015 at 02:26 PM Solution Report Share #589583 Posted November 10, 2015 at 02:26 PM Usa https://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now