473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

HttpWebRequest & HttpWebResponse in Windows forms apps

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
2 5426
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
1
by: ATS | last post by:
PRB - HttpWebRequest does not work with CGI websites and/or RAW data Please help, I'm trying to make a web deploying UserControl that gets RAW binary data that is dynamically created from a...
1
by: Jeremy Chapman | last post by:
In IIS, I've got an application directory called AuthenticationTest. I've also got an app directory called TestWinAuth. Both are under the wwwroot directory. My AuthenticationTest app enables...
0
by: Pmcg | last post by:
I would appreciate any help with the following, havn't found any answers for this in my research to date. I am trying to retreive a web page (a htm file intially) from a vdir on an intranet site...
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
1
by: bliz_87 | last post by:
Hello all, I'm trying to create a simple application that does a HTTP request/response on a button click. Here's the entire code which I got from a reference book: using...
2
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi I have a utility class, called MailHandler, that I wrote to read and operate on emails on an Exchange server using WebDAV. The WebDAV SQL statements are sent using an HttpWebRequest object....
0
by: ashurack | last post by:
I can't seem to get this to work. The URL I want to access is protected with windows authentication. I thought that was NTLM but the following isn't working: string url =...
0
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team is experiencing a problem when trying to access a WebService using SSL and through a proxy server after using the HttpWebRequest object. Under normal circumstances we are able to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.