Click here to Skip to main content
12,754,090 members (29,486 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

9.1K views
6 bookmarked
Posted 21 Apr 2011

Get WebPage SourceCode

, 21 Apr 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
you will need to add
using System.Net;


private static String webSource(String url)
            {
                return Encoding.ASCII.GetString(new WebClient().DownloadData(WebRequest.Create(url).GetResponse().ResponseUri));
            }


or you could also use

private static String webSource(String url)
            {
                return Encoding.ASCII.GetString(new WebClient().DownloadData(url));
            }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

charles henington
United States United States
I do not claim to be wrong! I just rarely ever write.

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 5 Pin
source.compiler11-Feb-13 19:58
membersource.compiler11-Feb-13 19:58 
GeneralNot all pages use ASCII encoding. You'd be better off using ... Pin
Richard Deeming28-Apr-11 13:00
memberRichard Deeming28-Apr-11 13:00 
Generalif your going to vote atleast leave a comment explaining the... Pin
charles henington22-Apr-11 5:57
membercharles henington22-Apr-11 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170217.1 | Last Updated 21 Apr 2011
Article Copyright 2011 by charles henington
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid