Employers - Post Free Jobs
Forum guidelines
AuthorQuestion
Error in reading xml file
Posted on: 09 Aug 2011
hi,
i am getting the following error,'http:/synd.cricbuzz.com/ashwl/scores-multi.xml' is not a valid virtual path. please suggest me how to remove this error.

 protected void Page_Load(object sender, EventArgs e)
  {
  string xmlfilepath = Server.MapPath(@"http://synd.cricbuzz.com/ashwl/scores-multi.xml");
  if (File.Exists(xmlfilepath))
  {
  using (DataSet ds = new DataSet())
  {
  XmlDocument doc = new XmlDocument();
  doc.LoadXml(File.ReadAllText(xmlfilepath));
  ds.ReadXml(new XmlNodeReader(doc));
  Repeater2.DataSource = ds;
  Repeater2.DataBind();
  }
  }

AuthorReply
Re: Error in reading xml file
Posted on: 09 Aug 2011  
Hi Chitra,

You have given full path of your xml.
So no need to use Server.MapPath here ,

just use,
 String xmlfilepath = @"http://synd.cricbuzz.com/ashwl/scores-multi.xml";

Thanks.

SPONSORED BY

Offshore Software and Database Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.