Edit: Not a duplicate, see the solution please. Required different solution than given possible duplicate link.
I'm trying to do a simple insert of record into database which also consist imagePath thus requires file upload. Like so:
public async Task<IActionResult> CreateArtifact(CreateArtifactViewModel input)
{
try
{
var path="";
if (input.File != null)
{
var fileName = Path.GetFileName(input.File.FileName);
path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Images/"), fileName);
file.SaveAs(path);
}
//rest of the method (irrelevant)...
But in the part where i do MapPath, i get error that HttpContext does not exist inside System.Web.
Did some research and tried to "add reference". But "add reference" window is just empty, only side projects that are in the solution are visible. So i added the System.web.dll reference by browse. But still no chance. Am i missing something, what can i do ?
Thanks.