Click here to Skip to main content
15,905,781 members

Comments by r.abhaysinghania (Top 20 by date)

r.abhaysinghania 31-Mar-17 1:53am View    
Yea it would be better and an easy way but this was a project given to me and my team mates.
r.abhaysinghania 30-Mar-17 3:13am View    
- System

- Provider

[ Name] Service1

- EventID 0

[ Qualifiers] 0

Level 4

Task 0

Keywords 0x80000000000000

- TimeCreated

[ SystemTime] 2017-03-30T06:30:06.000000000Z

EventRecordID 5137

Channel Application

Computer t_Ext.Siy.co.in

Security


- EventData

Service started successfully.

this is the event log in event viewer

I didn't understood much from the above event viewer
r.abhaysinghania 29-Mar-17 5:48am View    
Will change it and try again. thank you.
r.abhaysinghania 27-Mar-17 2:07am View    
I saw the link you gave but I m not authorize for the same.
r.abhaysinghania 25-Mar-17 6:22am View    
ERROR: //Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.FtpWebRequest'.
class ftp
{
private string host = null;
private string user = null;
private string pass = null;
private FtpWebRequest ftpRequest = null;
private FtpWebResponse ftpResponse = null;
private Stream ftpStream = null;
private int bufferSize = 2048;

/* Construct Object */
public ftp(string hostIP, string userName, string password) { host = hostIP; user = userName; pass = password; }

/* Download File */
public void download(string remoteFile, string localFile)
{
try
{
/* Create an FTP Request */
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + remoteFile);// error here
/* Log in to the FTP Server with the User Name and Password Provided */
ftpRequest.Credentials = new NetworkCredential(user, pass);
/* When in doubt, use these options */
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
/* Specify the Type of FTP Request */
ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;
/* Establish Return Communication with the FTP Server */
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
/* Get the FTP Server's Response Stream */
ftpStream = ftpResponse.GetResponseStream();
/* Open a File Stream to Write the Downloaded File */
FileStream localFileStream = new FileStream(localFile, FileMode.Create);
/* Buffer for the Downloaded Data */
byte[] byteBuffer = new byte[bufferSize];
int bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
/* Download the File by Writing the Buffered Data Until the Transfer is Complete */
try
{
while (bytesRead > 0)
{
localFileStream.Write(byteBuffer, 0, bytesRead);
bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
/* Resource Cleanup */
localFileStream.Close();
ftpStream.Close();
ftpResponse.Close();
ftpRequest = null;
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
return;
}
}

// Instantiate ftp class with parameters
ftp myFTP = new ftp("//192.168.1.10", "(username)", "(password)");
// Download the file
myFTP.download("//192.168.10.100", "/temp/stock/stock12800");