I want to load an XML file which is in D: drive. This is what I used\[code\]doc.Load(System.Web.HttpContext.Current.Server.MapPath("/D:/Employee.xml"));\[/code\]But it gives me an error whenever I try to run my program:Object reference not set to an instance of an object.I read it somewhere that Server.MapPath can be used only for webpages or web apps. I made a form in asp.net using c#.Why am I getting this error?This is my code:\[code\] private void btnRead_Click(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load("D:\\Employee.xml"); XmlNode root = doc.DocumentElement; StringBuilder sb = new StringBuilder(); XmlNodeList nodeList = root.SelectNodes("Employee"); foreach (XmlNode node in nodeList) { sb.Append("Name: "); //Select the text from a single node,