how to download file in c#?
Microsoft Net Framework

  public FileResult Download(int id)
        {
                var filename = string.Empty;
                var model = db.Cracks.Find(id);
                filename = model.CracksImage;
                string url = HttpContext.Server.MapPath("~/" + AppConstants.RecipesImages+"/"+ filename);
                byte[] fileBytes = System.IO.File.ReadAllBytes(url);
                return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, filename);
            
          } 


 <div class=" col-md-offset-7">
                                     <a href="~/BrowseCracks/Download/@item.CracksId"> <button class="btn btn-primary">Download </button></a>
                                 </div>

Share This with your friend by choosing any social account


Upcoming Articles
You may also read following recent Post
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM