i am having some problems with downloading a source code with my win form application. The problem is that when im browsing on the web page i need username and password to get my information. When i try to use this programaticly i dont know how to pass this username and password to the site.
For the sites that does not require username and password i am doing with this
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://hockey.powerplaymanager.com/");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
StreamWriter sw =new StreamWriter("test.txt");
while ((line=readStream.ReadLine())!=null)
{
sw.WriteLine(line);
}
sw.Close();
Can i somehowe pass username and password to the site?
Hope you get what i want to do.
Thanks

Posted Oct 19, 2010, 4:38 AM EDT
request.Credentials = new NetworkCredential(UserName, Password);
jure poteko5 reputationPosted Oct 19, 2010, 4:52 AM EDT
Posted Oct 20, 2010, 6:46 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Oct 20, 2010, 7:32 AM EDT
check you have internet connection or your network allowing to access the given url...
refer the code, i used
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://hockey.powerplaymanager.com/"); //request.Credentials = new NetworkCredential(UserName, Password); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); StreamWriter sw =new StreamWriter("G://test.txt"); String line; while ((line=readStream.ReadLine())!=null) { sw.WriteLine(line); } sw.Close();jure poteko5 reputationPosted Oct 20, 2010, 9:04 AM EDT
So now i have downloaded both of th source files and upload it to the megaupload.com
this is the file with my "user &pass"
http://www.megaupload.com/?d=2SX1IYYG
and this is the one without "user &pass".
http://www.megaupload.com/?d=SX1YYGFD
Files are in .txt format.
The important stuff in thease 2 files starts in 1st file at line 302 and in second file at line 260. At the second file the information that is given to me is missing some lines lines that i need from file 1.
Oh and Suthish is your code any diffrent that the one i have provided in my first post? I dont see the differance.
Thanks