прекратить очистку HttpRuntime.Cache для File.WriteAllBytes - PullRequest
0 голосов
/ 19 сентября 2019

Я не знаю, почему HttpRuntime.Cache[this.User.Identity.Name] очищает при использовании File.WriteAllBytes

Мой код

CurrentUserInfo currentUserInfo = (CurrentUserInfo)HttpRuntime.Cache[this.User.Identity.Name];

var content = await Request.Content.ReadAsByteArrayAsync();
currentUserInfo = (CurrentUserInfo)HttpRuntime.Cache[this.User.Identity.Name];

string filePath = HttpContext.Current.Server.MapPath($"~/bin/InsuranceFile/1");

if (!Directory.Exists(filePath))
    Directory.CreateDirectory(filePath);

File.WriteAllBytes(filePath+$"/{Path.GetRandomFileName()}", content)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...