WebRequest myWebRequest = WebRequest.Create(str.ToString());
// Set the 'Timeout' property in Milliseconds.
#warning timeout value was set to 10000 for testing purpose
myWebRequest.Timeout = 10000;
// This request will throw a WebException if it reaches the timeout limit
before it is able to fetch the resource.
// ProductData _data = new ProductData();
DataSet ds = new DataSet("test");
try
{
WebResponse myWebResponse = myWebRequest.GetResponse();
StreamReader reader = new StreamReader(myWebResponse.GetResponseStream());
XmlTextReader read = new XmlTextReader(reader);
ds.ReadXml(read);
}
catch(WebException ex)
{
Debug.WriteLine(ex.Message);
throw;
}
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @
www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
Arne Garvander said:
Alvin,
I found a webclient class but no webrequest class.
--
Arne Garvander
Certified Geek
Alvin Bruney - ASP.NET MVP said:
have a look at the webrequest class
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @
www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
How do I make a HTTP request from a class?
I am writing a component that will run outside of the webserver. This
component will send xml files to another http server. I am not using SOAP.