.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; }
我有一个非常相似的不同项目,这在该项目中工作得很好。两者都是使用 Entity Framework 的 ASP.NET Core Web App。
那么问题是什么?为什么这在 1 个项目中可以正常工作,而在另一个项目中却不行?