On IIS Express, everything works fine. I transfer to the server - when I try to download the file, it writes "Could not download". Although physically it is in the inetpub folder. IUSRS user rights are given full on the inetpub folder
var date = DateTime.Parse(model.Date).ToString("dd.MM.yyyy h:MM:ss"); string newstring = client.HelloBaza(normalUser, date); System.IO.File.WriteAllBytes(Server.MapPath("~/"+normalUser+".xlsx"), Convert.FromBase64String(newstring)); string filepath = Server.MapPath("~/" + normalUser + ".xlsx"); byte[] filedata = System.IO.File.ReadAllBytes(filepath); string contentType = MimeMapping.GetMimeMapping(filepath); var cd = new System.Net.Mime.ContentDisposition { FileName = normalUser + ".xlsx", Inline = true, }; Response.AppendHeader("Content-Disposition", cd.ToString()); return File(filedata, contentType);
Response.Write(filedata)- nick_n_a