2020年10月6日 星期二

上傳檔案存入資料庫後取得並轉為 memorystream

var model = db.file.Find(id);
var filecontent=System.Text.Encoding.ASCII.GetString(model.content).Split(',')[1]; // content欄位為varbinary(max)
using (var stream = new System.IO.MemoryStream(Convert.FromBase64String(filecontent)))
{

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...