public FileResult GetBytes(string GUID) { Document doc = repos3.GetDocument(GUID); byte[] mas = doc.Data; string type = ""; for (int i = doc.Name.LastIndexOf('.'); i < doc.Name.Length; i++) { type += GUID[i]; } string file_type = "application/" + type; string file_name = doc.Name; return(File(mas, file_type, file_name)); }