this one helps. 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.
will be helpful for those in need The method is accessible via the System.Web.HttpContext.Current.Server object. Just set a reference to System.Web.HttpContext.Current.Server and call the method like normal.
var server = HttpContext.Current.Server;
Difference between Server.MapPath and Page.MapPath