|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HTTP RequestHow 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. -- Arne Garvander Certified Geek have a look at the webrequest class
-- Show quoteRegards, 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" <ArneGarvan***@discussions.microsoft.com> wrote in message news:28E33AD9-A969-48A1-B189-B27DF0E705A0@microsoft.com... > 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. > -- > Arne Garvander > Certified Geek > Alvin,
I found a webclient class but no webrequest class. -- Show quoteArne Garvander Certified Geek "Alvin Bruney - ASP.NET MVP" wrote: > 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 > ------------------------------------------------------- > > > > "Arne Garvander" <ArneGarvan***@discussions.microsoft.com> wrote in message > news:28E33AD9-A969-48A1-B189-B27DF0E705A0@microsoft.com... > > 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. > > -- > > Arne Garvander > > Certified Geek > > > > > 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; } -- Show quoteRegards, 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" <ArneGarvan***@discussions.microsoft.com> wrote in message news:C182A84A-A283-4F60-A0C3-5EB953673B6A@microsoft.com... > Alvin, > I found a webclient class but no webrequest class. > -- > Arne Garvander > Certified Geek > > > > "Alvin Bruney - ASP.NET MVP" wrote: > > > 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 > > ------------------------------------------------------- > > > > > > > > "Arne Garvander" <ArneGarvan***@discussions.microsoft.com> wrote in message > > news:28E33AD9-A969-48A1-B189-B27DF0E705A0@microsoft.com... > > > 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. > > > -- > > > Arne Garvander > > > Certified Geek > > > > > > > > > Thus wrote Arne,
> How do I make a HTTP request from a class? Check out System.Net.WebClient or System.Net.HttpWebRequest.> 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. Cheers, -- Joerg Jooss news-re***@joergjooss.de |
|||||||||||||||||||||||