Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

HTTP Request

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arne Garvander - 06 Mar 2006 21:36 GMT
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.
Signature

Arne Garvander
Certified Geek

Alvin Bruney - ASP.NET MVP - 06 Mar 2006 21:37 GMT
have a look at the webrequest class

Signature

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.
Arne Garvander - 06 Mar 2006 21:50 GMT
Alvin,
I found a webclient class but no webrequest class.
Signature

Arne Garvander
Certified Geek

> have a look at the webrequest class
>
> > 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.
Alvin Bruney - ASP.NET MVP - 07 Mar 2006 16:37 GMT
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;

}

Signature

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

> Alvin,
> I found a webclient class but no webrequest class.
[quoted text clipped - 4 lines]
> > > 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.
Joerg Jooss - 06 Mar 2006 21:42 GMT
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,
Signature

Joerg Jooss
news-reply@joergjooss.de


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.