Click here to Skip to main content
14,549,480 members
Rate this:
Please Sign up or sign in to vote.
See more:

My website based on C# contains two text boxes.. txtURL and txtRead and a button btnRead.

I want that if i put a web blog's post link.... i.e. for the blog and now for the post

I want that if i add the link to the txtURL and Click on btnRead then the Post comes to textbox txtRead (only the post text )

It is like going to a website and reading a post there. The same post i want to get on my text box using C# so that i can read it on my page using textbox.

Also i tried this code but it gives the html coding of the page and i want is the post content.

using System; 
using System.IO; 
using System.Net; 
using System.Text; 

    public static void GetFile 
            string strURL, 
            string strFilePath 

            WebRequest myWebRequest = WebRequest.Create(strURL);  

            WebResponse myWebResponse = myWebRequest.GetResponse();  

            Stream ReceiveStream = myWebResponse.GetResponseStream(); 
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); 

            StreamReader readStream = new StreamReader( ReceiveStream, encode ); 

            string strResponse=readStream.ReadToEnd(); 
            StreamWriter oSw=new StreamWriter(strFilePath); 




So please suggest me the methods to read the blog content.


1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Try this at the end.
Dim wb As New WebBrowser
Dim doc As HtmlDocument
'You can get result by

This will get you the post with all comments. main-wrapper is the div which holds these content. The other way is to parse the HTML content in the file.
LockedOut 26-Aug-11 9:55am
Hey can you please elobrate bit more about this "main-wrapper" code with some example.


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100