Click here to Skip to main content
15,904,416 members
Home / Discussions / C#
   

C#

 
QuestionMessage Removed Pin
14-Jun-11 18:38
nehajain1214-Jun-11 18:38 
AnswerRe: Dwnload file in c# Pin
walterhevedeich14-Jun-11 19:02
professionalwalterhevedeich14-Jun-11 19:02 
GeneralRe: Dwnload file in c# Pin
Richard MacCutchan16-Jun-11 3:43
mveRichard MacCutchan16-Jun-11 3:43 
AnswerRe: Dwnload file in c# Pin
Ravi Sant20-Jun-11 1:25
Ravi Sant20-Jun-11 1:25 
QuestionDeny access to a datatable while in use from another object Pin
MAW3014-Jun-11 18:10
MAW3014-Jun-11 18:10 
AnswerRe: Deny access to a datatable while in use from another object Pin
Richard Andrew x6414-Jun-11 20:12
professionalRichard Andrew x6414-Jun-11 20:12 
AnswerRe: Deny access to a datatable while in use from another object Pin
jschell15-Jun-11 9:04
jschell15-Jun-11 9:04 
QuestionParsing HTML of some website using C Sharp. Pin
shivamkalra14-Jun-11 15:35
shivamkalra14-Jun-11 15:35 
Hello everyone,

I'm working on a small hobby project. I'm making a web crawler for a particular website to extract some useful information from it. I've written information extraction algorithms but I'm completely new to HTTP response stuff. I'm using a HttpWebResponse class of .Net to get the source code of a webpage in form of StreamReader. Now, I'm wondering if I should process each line of stream or I should convert whole streamReader to a string and then process that. Let say, I'm looking for string that should be able to extract .mp3 links on webpage using regex then is it possible that a single link is on two differnt lines of StreamReader, look at the code below..

            string url = "http://songs.pk";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            StreamReader sr = new StreamReader(response.GetResponseStream());

            string line;
            while ((line = sr.ReadLine()) != null)
            {
// Add some processing code here
                Console.Read();
                Console.WriteLine(line);
            }


Now can I add some regex matching code here..will this code make sure that it will be able to extract all the .mp3 links from this website? Or should I convert the StreamReader to string and then use regex matching on that string?

I'm sorry, if I'm misunderstanding about StreamReader here, but I need some suggestions to parse the source code of a website. I've searched articles and Google but I'm unable to find something that could help me. Any articles, links or suggestions would be appreciated.

Thanks
Shivam Kalra
AnswerRe: Parsing HTML of some website using C Sharp. Pin
JV999914-Jun-11 21:55
professionalJV999914-Jun-11 21:55 
AnswerRe: Parsing HTML of some website using C Sharp. Pin
BobJanova15-Jun-11 0:29
BobJanova15-Jun-11 0:29 
AnswerRe: Parsing HTML of some website using C Sharp. Pin
GenJerDan15-Jun-11 3:59
GenJerDan15-Jun-11 3:59 
QuestionCall Web Service Without Reference? Pin
Kevin Marois14-Jun-11 12:02
professionalKevin Marois14-Jun-11 12:02 
AnswerRe: Call Web Service Without Reference? Pin
Kevin Marois14-Jun-11 13:13
professionalKevin Marois14-Jun-11 13:13 
AnswerRe: Call Web Service Without Reference? Pin
PIEBALDconsult14-Jun-11 14:11
mvePIEBALDconsult14-Jun-11 14:11 
QuestionHow to learn Web Based Apps? Pin
Software200714-Jun-11 5:44
Software200714-Jun-11 5:44 
AnswerRe: How to learn Web Based Apps? Pin
#realJSOP14-Jun-11 7:19
professional#realJSOP14-Jun-11 7:19 
GeneralRe: How to learn Web Based Apps? Pin
Software200714-Jun-11 8:07
Software200714-Jun-11 8:07 
GeneralRe: How to learn Web Based Apps? Pin
l a u r e n14-Jun-11 8:59
l a u r e n14-Jun-11 8:59 
GeneralRe: How to learn Web Based Apps? Pin
Roger Wright14-Jun-11 21:27
professionalRoger Wright14-Jun-11 21:27 
GeneralRe: How to learn Web Based Apps? Pin
Mark Salsbery17-Jun-11 10:38
Mark Salsbery17-Jun-11 10:38 
GeneralRe: How to learn Web Based Apps? Pin
#realJSOP18-Jun-11 1:08
professional#realJSOP18-Jun-11 1:08 
AnswerRe: How to learn Web Based Apps? Pin
Lutosław14-Jun-11 21:47
Lutosław14-Jun-11 21:47 
GeneralRe: How to learn Web Based Apps? Pin
Software200715-Jun-11 10:28
Software200715-Jun-11 10:28 
GeneralRe: How to learn Web Based Apps? Pin
Lutosław15-Jun-11 12:16
Lutosław15-Jun-11 12:16 
QuestionHow to retrieve single row from datatable? Pin
SRKSHOME14-Jun-11 3:47
SRKSHOME14-Jun-11 3:47 

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.