---
title: "Download File in Asp.Net Mvc 4"  
description: "In this article, I’m explaining how to implement the download file concept in asp.net mvc 4."  
author: "Sumit Kesarwani"  
published: 2014-08-26  
updated: 2020-06-29  
canonical: https://www.mindstick.com/articles/1483/download-file-in-asp-dot-net-mvc-4  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 1 minute  

---

# Download File in Asp.Net Mvc 4

In this article, I’m explaining how to [implement the download file](https://www.mindstick.com/articles/628/process-start-in-c-sharp-with-examples) concept in asp.net MVC 4.

#### Step 1 -

First, create a basic asp.net MVC 4 application and add a controller named **“HomeController”** to it:

```
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc; namespace DownloadFileMvcApp.Controllers{    public class HomeController : Controller    {        //        // GET: /Home/         public ActionResult Index()        {            return View();        }                public FileResult downloadFile()        {            return new FilePathResult(Server.MapPath("/File/dummy.docx"), "application/vnd.openxmlformats-officedocument.wordprocessingml.document");        }     }}
```

#### Step 2

Now add a folder to the project named “File” and add a word file to it:

![Download File in Asp.Net Mvc 4](http://www.mindstick.com/MindStickArticle/57ef7025-81b4-4d2f-8580-f4e171ac9dc7/Images/image001.png)

#### Step 3

Now add a view named “Index” to the project:

```
@{    ViewBag.Title = "Index";} <h2>Download File Sample</h2> <div>    @Html.ActionLink("Download File", "downloadFile", "Home")</div>
```

Output

Now run the application:

![Download File in Asp.Net Mvc 4](http://www.mindstick.com/MindStickArticle/57ef7025-81b4-4d2f-8580-f4e171ac9dc7/Images/image003.png)

Click on the download file link:

![Download File in Asp.Net Mvc 4](http://www.mindstick.com/MindStickArticle/57ef7025-81b4-4d2f-8580-f4e171ac9dc7/Images/image005.png)

Your file will be downloaded.

---

Original Source: https://www.mindstick.com/articles/1483/download-file-in-asp-dot-net-mvc-4

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
