Search code examples
c#.netemailserver.mappath

System.Web.UI not giving me the MapPath


I am working on a mailSender Class. I can't use the Server.MapPath method from the System.Web.UI Namespace. What reference should i set to make this work? I have referenced to the System / System.Web / System.Web.UI.

This is the msdn i have checked.


Solution

  • Please read TaylorMichaelL answer on this page: The name 'Server' does not exist in the current context. This should help you.

    A better approach though is that you add the target folder as a method argument and create the path from that. That way, the class will be usable in non-web contexts as well.