By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,236 Members | 1,839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,236 IT Pros & Developers. It's quick & easy.

HttpWebRequest & HttpWebResponse in Windows forms apps

P: n/a
Hi,

Can anyone please tell me if it's possible to use HttpWebRequest and
HttpWebResponse in a class in a Windows application? I've tried referencing
System and System.Web but there's still something missing.

Any assistance gratefully received.

Best,

Mark Rae
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Here's how i do it, hope it helps:

protected string GetPage(string Page,System.Text.Encoding encoding,string
Method)

{

HttpWebRequest JobSiteRequest = (HttpWebRequest)WebRequest.Create(Page);

JobSiteRequest.Method = Method;

HttpWebResponse JobSiteResponse =
(HttpWebResponse)JobSiteRequest.GetResponse();

Stream JobSiteStream = JobSiteResponse.GetResponseStream();

StreamReader JobSiteData = new StreamReader(JobSiteStream,encoding);

string Data = JobSiteData.ReadToEnd();

JobSiteStream.Close();

JobSiteResponse.Close();

return Data;

}

"Mark Rae" <ma**@markrae.co.uk> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
Hi,

Can anyone please tell me if it's possible to use HttpWebRequest and
HttpWebResponse in a class in a Windows application? I've tried referencing System and System.Web but there's still something missing.

Any assistance gratefully received.

Best,

Mark Rae

Nov 15 '05 #2

P: n/a
"Miki Watts" <mi*****@netvision.net.il> wrote in message
news:Ep********************@giganews.com...
Here's how i do it, hope it helps:


Perfect! Thanks very much!
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.