accessing web pages and emails from c#

  • Thread starter Thread starter Duncan Winn
  • Start date Start date
D

Duncan Winn

Is there any way that my C# application can go to a web page (or email) and
copy the information (as a picture) and display it in my application. I
want my application to self update it's graphics (based on a surf report)
without having to go to web sites directly and copy the information. Surf
reports can be sent by email as opposed to copying from the web so that is
also a possibility.

Any suggestions?

thanks,

Duncan.
 
The WebClient and WebRequest classes allow you to upload and download
information using HTTP.

For email, you'd need to get a 3rd party POP3 component, or write your own
simple one using TcpClient.

-mike
MVP
 
When try to download file info from a web addres I get the error message

"Proxy Authentication Required"

Is there any way around this?

string remoteUri = http://www.croyde-surf-cam.com/;

string fileName = "ms-banner.gif", myStringWebResource = null;

WebClient myWebClient = new WebClient();

myStringWebResource = remoteUri + fileName;

myWebClient.DownloadFile(myStringWebResource,fileName);
 
The WebProxy can deal with proxies. I'd imagine that could help (if it's a
proxy blocking you).
-mike
MVP
 
Hi, thanks, for all your help,

I have managed to get access to the web page (i.e. the html data) but I do
not know how to download the data?
i.e. what do I do with the web response?

So far I have.........

WebProxy proxyObject = new WebProxy(my_web_page ,true);

// Initialize the WebRequest.

WebRequest myRequest = WebRequest.Create(my_web_page);

//set proxy

myRequest.Proxy = proxyObject;

// Return the response.

WebResponse myResponse = myRequest.GetResponse();
 
Back
Top