We have the following code that parses the XML file that is saved locally, how do I load the XML file that is hosted in the internet?
private void BindGrid()
{
using (DataSet ds = new DataSet())
{
ds.ReadXml(Server.MapPath("~/test-xml-data.xml"));
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
I tried the following, but it throws an error saying
System.Web.HttpException: 'https:/www.w3schools.com/xml/cd_catalog.xml' is not a valid virtual path
ds.ReadXml(Server.MapPath("https://www.w3schools.com/xml/cd_catalog.xml"));