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
jure potekoPosted Oct 20, 2010, 1:04 PM
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
Suthish NairPosted Oct 20, 2010, 11:32 AM
check you have internet connection or your network allowing to access the given url...
refer the code, i used
Posted Oct 20, 2010, 10:46 AM
jure potekoPosted Oct 19, 2010, 8:52 AM
Posted Oct 19, 2010, 8:38 AM
request.Credentials = new NetworkCredential(UserName, Password);