HttpContext.Current.Server.MapPath Error: Object reference not set to an instance of an object

on Feb 18, 2021 10:33 PM

I have got a code which, I believe, has been working for ages but it suddenly comes up with an error when referencing the Server.MapPath in a class.

I am using HttpContext.Current.Server.MapPath but now I seem to get an error saying "Object reference not set to an instance of an object"

Catch ex As Exception
    Using w As StreamWriter = File.AppendText(System.Web.HttpContext.Current.Server.MapPath("../App_Data/") & "logCopiarACP_" & pEm_Id & ".txt")
        Log("CopiarPropiedades2015_Videos " & ex.Message, w)
    End Using


Download FREE API for Word, Excel and PDF in ASP.Net: Download
This question does not have answers.