public IActionResult FileRead(int id, int lang = 1) { FileStream stream = null; //string str = "Persist Security Info=False;User ID=sa;Initial Catalog=INTODB;Data Source=192.168.100.63"; //string str = "Persist Security Info=False;User ID=sa;Initial Catalog=INTODB;Data Source=TOSHIBA"; var files = FileDB.GetFile(id, lang = 1, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION)); var file = files.Data.First(); if (System.IO.File.Exists(file.Path)) { stream = new FileStream(file.Path, FileMode.Open); byte[] m_Bytes = ReadToEnd(stream); string pdfBase64 = Convert.ToBase64String(m_Bytes); stream.Close(); int dot = file.Name.LastIndexOf("."); int length = file.Name.Length - dot; string type = file.Name.Substring(dot + 1, length - 1); FileSetting opFile = new FileSetting(); opFile.Base64 = pdfBase64; opFile.TypeOfFile = type; return(Json(opFile)); } return(Json("File Not found")); }