open web links like files

I am developing an application In C# .NET 2.0. I need to get the Raw HTML code for some internet links/sites.

I don't want to render the HTML. I just need the raw HTML. The file stream methods/classes doesn't allow UNC paths. So, how do I do that. I don't even want to write code for HTTP protocol.
LVL 1
ashu01Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
amit_gConnect With a Mentor Commented:
System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile(URL, FilePathToSaveHTML);

or use

HTML = wc.DownloadString(URL);
0
 
ashu01Author Commented:
I is possible to use POST method for HTTP and allow the site to set a cookie...which will then be used for subsequent calls?
0
 
amit_gCommented:
Use one of the overloaded methods UploadData to do the POST.

http://msdn2.microsoft.com/en-us/library/system.net.webclient.uploaddata.aspx

If you also need to set cookie, then you need to use HTTPWebRequest class

http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest(vs.71).aspx
0
All Courses

From novice to tech pro — start learning today.