P
Patrick Olurotimi Ige
compiling the code below i get the error:-
Cannot implicitly convert type 'object'to 'System.Xml.XmlDocument'
I'm getting the error on this line:-
myXml.Document = getXML("http://www.crn.com.au/rss.aspx?SCID=9");
Any ideas?
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
myXml.Document = getXML("http://www.crn.com.au/rss.aspx?SCID=9");
}
object getXML(string sourceFile)
{
System.Net.WebRequest myRequest =
System.Net.WebRequest.Create(sourceFile);
System.Net.WebResponse myResponse = myRequest.GetResponse();
System.Xml.XmlTextReader myReader = new
System.Xml.XmlTextReader(myResponse.GetResponseStream());
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(myReader);
getXML = doc;
myResponse.Close();
myReader.Close();
}
Cannot implicitly convert type 'object'to 'System.Xml.XmlDocument'
I'm getting the error on this line:-
myXml.Document = getXML("http://www.crn.com.au/rss.aspx?SCID=9");
Any ideas?
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
myXml.Document = getXML("http://www.crn.com.au/rss.aspx?SCID=9");
}
object getXML(string sourceFile)
{
System.Net.WebRequest myRequest =
System.Net.WebRequest.Create(sourceFile);
System.Net.WebResponse myResponse = myRequest.GetResponse();
System.Xml.XmlTextReader myReader = new
System.Xml.XmlTextReader(myResponse.GetResponseStream());
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(myReader);
getXML = doc;
myResponse.Close();
myReader.Close();
}