Click here to Skip to main content
15,910,981 members
Home / Discussions / C#
   

C#

 
AnswerRe: Calling C# function in javascript tag Pin
led mike17-Jul-07 7:37
led mike17-Jul-07 7:37 
QuestionC# custom installers Pin
Harkamal Singh17-Jul-07 7:02
Harkamal Singh17-Jul-07 7:02 
AnswerRe: C# custom installers Pin
LongRange.Shooter17-Jul-07 7:20
LongRange.Shooter17-Jul-07 7:20 
GeneralRe: C# custom installers Pin
Harkamal Singh18-Jul-07 4:41
Harkamal Singh18-Jul-07 4:41 
QuestionDownload a File from RapidShare Pin
Jette2k717-Jul-07 6:23
Jette2k717-Jul-07 6:23 
AnswerRe: Download a File from RapidShare Pin
Vasudevan Deepak Kumar17-Jul-07 6:38
Vasudevan Deepak Kumar17-Jul-07 6:38 
GeneralRe: Download a File from RapidShare Pin
Jette2k717-Jul-07 6:39
Jette2k717-Jul-07 6:39 
GeneralRe: Download a File from RapidShare Pin
Shailen S.20-Apr-09 7:29
Shailen S.20-Apr-09 7:29 
I', trying to download a rapidshare file using a premium account but I'm stuck.

My Download() Method:
private void Download()
{
using (WebClient wcDownload = new WebClient())
{
try
{

webRequest = (HttpWebRequest)WebRequest.Create(txtUrl.Text);
webRequest.PreAuthenticate = true;

//**QUESTION:**I'm not very sure if I should use NetworkCredential to authenticate myself.
NetworkCredential networkCredential = new NetworkCredential("username", "password", "rapidshare.com");
webRequest.Credentials = networkCredential;

webResponse = (HttpWebResponse)webRequest.GetResponse();
// Open the URL for download
strResponse = wcDownload.OpenRead(txtUrl.Text);
// Create a new file stream where we will be saving the data (local drive)
strLocal = new FileStream(txtPath.Text, FileMode.Create, FileAccess.Write, FileShare.None);

// It will store the current number of bytes we retrieved from the server
int bytesSize = 0;
// A buffer for storing and writing the data retrieved from the server
byte[] downBuffer = new byte[2048];

// Loop through the buffer until the buffer is empty
while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
// Write the data from the buffer to the local hard drive
strLocal.Write(downBuffer, 0, bytesSize);
}
}
finally
{
// close the streams when job done
strResponse.Close();
strLocal.Close();
}
}
}


**QUESTION:**I'm not very sure if I should use NetworkCredential to authenticate myself.
Any ideas if authentication should be done via Cookie? If yes, how? HttpCookie?

Thanks.
GeneralRe: Download a File from RapidShare Pin
Jette2k717-Jul-07 6:46
Jette2k717-Jul-07 6:46 
AnswerRe: Download a File from RapidShare Pin
Scott Dorman17-Jul-07 8:13
professionalScott Dorman17-Jul-07 8:13 
GeneralRe: Download a File from RapidShare Pin
Jette2k717-Jul-07 8:25
Jette2k717-Jul-07 8:25 
QuestionAnyone gone the Microsoft Route..... Pin
Strategon17-Jul-07 5:09
Strategon17-Jul-07 5:09 
AnswerRe: Anyone gone the Microsoft Route..... Pin
Eduard Keilholz17-Jul-07 5:25
Eduard Keilholz17-Jul-07 5:25 
GeneralRe: Anyone gone the Microsoft Route..... Pin
led mike17-Jul-07 5:53
led mike17-Jul-07 5:53 
AnswerRe: Anyone gone the Microsoft Route..... Pin
Bert delaVega17-Jul-07 6:02
Bert delaVega17-Jul-07 6:02 
AnswerRe: Anyone gone the Microsoft Route..... Pin
LongRange.Shooter17-Jul-07 7:26
LongRange.Shooter17-Jul-07 7:26 
QuestionNeed help in tree view... Pin
Dotnetkanna17-Jul-07 4:15
Dotnetkanna17-Jul-07 4:15 
AnswerRe: Need help in tree view... Pin
Manas Bhardwaj17-Jul-07 4:24
professionalManas Bhardwaj17-Jul-07 4:24 
AnswerRe: Need help in tree view... Pin
Nxorable17-Jul-07 4:30
Nxorable17-Jul-07 4:30 
QuestionNetwork Discovery Pin
originSH17-Jul-07 4:00
originSH17-Jul-07 4:00 
AnswerRe: Network Discovery Pin
Manas Bhardwaj17-Jul-07 4:28
professionalManas Bhardwaj17-Jul-07 4:28 
GeneralRe: Network Discovery Pin
originSH17-Jul-07 4:32
originSH17-Jul-07 4:32 
QuestionSoapException in C# Web Service that references COM object Pin
Nxorable17-Jul-07 2:56
Nxorable17-Jul-07 2:56 
AnswerRe: SoapException in C# Web Service that references COM object Pin
led mike17-Jul-07 4:38
led mike17-Jul-07 4:38 
GeneralRe: SoapException in C# Web Service that references COM object Pin
Nxorable17-Jul-07 4:47
Nxorable17-Jul-07 4: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.