Server.Mappath in C# classlibrary
问题 How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite 回答1: By calling it? var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx"); Make sure you add a reference to the System.Web assembly. 回答2: You can get the base path by using the following code and append your needed path with that. string path = System.AppDomain.CurrentDomain.BaseDirectory; 回答3: You should reference System.Web and call: HttpContext