ASP.Net HttpPostedFileBase 缺少参考

问题描述

.NET 5.0 我在尝试使用 HttpPostedFileBase 时遇到错误

The type or namespace name 'HttpPostedFileBase'Could not be found(are you missing a using directive or an assembly reference?)

我包含了 using System.web 但它根本没有做任何事情。

[NotMapped]
[RegularExpression(@"([a-zA-Z0-9\s_\\.\-:])+(.png|.jpg|.pdf|.doc)$",ErrorMessage = "File type not allowed. File must be .png,.jpg,.pdf,or .doc.")]
public HttpPostedFileBase PostedFile { get; set; }

我有一个非常相似的不同项目,这在该项目中运行良好。两者都是使用实体框架的 ASP.NET Core Web App。

那么问题出在哪里?为什么这可以在 1 个项目中正常工作,而在另一个项目中却不能?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)