S
shaily903
hi
I am looking for writing a c# web crawler .
Requirements: I need to browse the "general mail" site daily to see if
there is new Email present in my Inbox. I want to automate this whole
process by writing a web crawler which will crawl these site,enter my
login username and password then let me know if there is any new email.
I started writing like below:
//First, I downloaded the page by using the HttpWebRequest class
provided by C#.
private void GetUrlData()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
WebResponse response = request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();
//now the stream is read as text. To do this, a reader is obtained
and the
// file is added to a buffer, line by line.
string buffer = "",line;
StreamReader reader = new StreamReader(stream);
while( (line = reader.ReadLine())!=null )
{
buffer+=line+"\r\n";
}
CreateFile(buffer); //then i created a text file and wrote the whole
stream
}
private void CreateFile(string buffer)
{
string filename = "c:\\test";
StreamWriter outStream = new StreamWriter( filename );
outStream.Write(buffer);
outStream.Close();
}
Question :
1. As per my requirements above I need to login to my site(i.e. I need
to give username and password,to go to my inbox). How to do that
programatically?
Thanks
Shaily
I am looking for writing a c# web crawler .
Requirements: I need to browse the "general mail" site daily to see if
there is new Email present in my Inbox. I want to automate this whole
process by writing a web crawler which will crawl these site,enter my
login username and password then let me know if there is any new email.
I started writing like below:
//First, I downloaded the page by using the HttpWebRequest class
provided by C#.
private void GetUrlData()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
WebResponse response = request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();
//now the stream is read as text. To do this, a reader is obtained
and the
// file is added to a buffer, line by line.
string buffer = "",line;
StreamReader reader = new StreamReader(stream);
while( (line = reader.ReadLine())!=null )
{
buffer+=line+"\r\n";
}
CreateFile(buffer); //then i created a text file and wrote the whole
stream
}
private void CreateFile(string buffer)
{
string filename = "c:\\test";
StreamWriter outStream = new StreamWriter( filename );
outStream.Write(buffer);
outStream.Close();
}
Question :
1. As per my requirements above I need to login to my site(i.e. I need
to give username and password,to go to my inbox). How to do that
programatically?
Thanks
Shaily