ASP.Net HttpPostedFileBase missing reference

176 views Asked by At

.NET 5.0 I'm getting an error trying to use HttpPostedFileBase:

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

I have included using System.web but it isn't doing anything at all.

[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; }

I have a different project that is very very similar and this works just fine in that project. Both are ASP.NET Core Web App using Entity Framework.

So what is the problem? Why would this work fine in 1 project but not another?

0

There are 0 answers