I have a web application thet has a number of class library projects. Some example code below.
public static class LenderBL
{
static string LenderXml { get { return "MyPathHere"; } }
public static LenderColl GetLenders()
{
var serializer = new XmlSerializer(typeof(LenderColl));
using (XmlReader reader = XmlReader.Create(LenderXml))
{
return (LenderColl)serializer.Deserialize(reader);
}
}
}
I would normally use Server.MapPath to get the path for the property LenderXml, but when I use it in a class library is returns the path of the parent solution, not that of the class library project.
Is there a way of getting the path for the class libary project itself?
Thanks in advance.
var Mappingpath = System.Web.HttpContext.Current.Server.MapPath("pagename.aspx");
Hope its helpful.