Home All Groups Group Topic Archive Search About
Author
6 Mar 2006 9:36 PM
Arne Garvander
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

Author
6 Mar 2006 9:37 PM
Alvin Bruney - ASP.NET MVP
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
-------------------------------------------------------



Show quote
"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
>
Author
6 Mar 2006 9:50 PM
Arne Garvander
Alvin,
I found a webclient class but no webrequest class.
--
Arne Garvander
Certified Geek



Show quote
"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
> >
>
>
>
Author
7 Mar 2006 4:37 PM
Alvin Bruney - ASP.NET MVP
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
-------------------------------------------------------



Show quote
"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
> > >
> >
> >
> >
Author
6 Mar 2006 9:42 PM
Joerg Jooss
Thus wrote Arne,

> 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.

Check out System.Net.WebClient or System.Net.HttpWebRequest.

Cheers,
--
Joerg Jooss
news-re***@joergjooss.de

AddThis Social Bookmark Button