public async Task <MemoryStream> GetFileAs(int id, bool id2) { string authHeader = Request.Headers["authentication"]; string[] auths = authHeader.Split(','); IdentityUser me = await _userManager.FindByIdAsync(auths[1]); UserData appMe = await _context.UserData.SingleAsync(p => p.UserId == me.Id); if (String.Compare(auths[2], appMe.MyGuid, StringComparison.Ordinal) != 0) { return(null); } string userID = auths[1]; NoteAccess myAcc = await AccessManager.GetAccess(_context, userID, id, 0); //TODO if (!myAcc.ReadAccess) { return(null); } ExportController myExp = new ExportController(_appEnv, _userManager, _signInManager, _context); Notes2021.Models.ExportViewModel model = new Notes2021.Models.ExportViewModel(); NoteFile nf = await NoteDataManager.GetFileById(_context, id); model.NoteOrdinal = 0; model.FileName = nf.NoteFileName; model.FileNum = nf.Id; model.directOutput = true; model.isCollapsible = id2; model.isHtml = id2; IdentityUser applicationUser = await _userManager .FindByEmailAsync(auths[0]); await _signInManager.SignInAsync(applicationUser, false); model.tzone = _context.TZone.Single(p => p.Id == appMe.TimeZoneID); return(await myExp.DoExport(model, User, 0)); //TODO }