I am using the following code within a class:
string filePath = HttpContext.Current.Server.MapPath("~/email/teste.html");
The file teste.html is in the folder
But when it will open the file the following error is being generated:
Object reference not set to an instance of an object.
MapPath
where the exception is occurring? It sounds like maybe there is a different line that throws the exception, if that's the case, can you post the line that actually throws the exception.NullReferenceException
are the same. Please see "What is a NullReferenceException in .NET?" for some hints.