Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# code is only inserting a few records. Pin
Richard Deeming29-Jun-15 4:44
mveRichard Deeming29-Jun-15 4:44 
GeneralRe: C# code is only inserting a few records. Pin
Norris Chappell29-Jun-15 5:04
Norris Chappell29-Jun-15 5:04 
GeneralRe: C# code is only inserting a few records. Pin
PIEBALDconsult25-Jun-15 10:10
mvePIEBALDconsult25-Jun-15 10:10 
GeneralRe: C# code is only inserting a few records. Pin
Norris Chappell25-Jun-15 10:35
Norris Chappell25-Jun-15 10:35 
GeneralRe: C# code is only inserting a few records. Pin
Sascha Lefèvre25-Jun-15 14:14
professionalSascha Lefèvre25-Jun-15 14:14 
GeneralRe: C# code is only inserting a few records. Pin
Norris Chappell25-Jun-15 15:49
Norris Chappell25-Jun-15 15:49 
GeneralRe: C# code is only inserting a few records. Pin
PIEBALDconsult29-Jun-15 15:36
mvePIEBALDconsult29-Jun-15 15:36 
QuestionFile permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T25-Jun-15 6:47
DanDan_T25-Jun-15 6:47 
Hi, I'm having trouble with the following code which takes a file on my local hard drive and writes it to a Linux server via FTP. It works, however the permissions of the file after it has been written to the server is 000 and I would like permission set to 775. Any ideas? The source file on my local hard drive is first created with the StreamWriter object.

C#
// Specify the file and location to be written to the server
string fileUri = "ftp://" + serverAddressTextBox.Text + "/" + masterDirectoryFileName;
DeleteFileOnServer(fileUri); // Deletes the file if it exists before writing a new one to the server
            
// instantiate the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(fileUri);
request.Method = WebRequestMethods.Ftp.UploadFile;

// Here we specify the logon credentials
request.Credentials = new NetworkCredential(ftpUserNameTextBox.Text, ftpPasswordTextBox.Text);

// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader(directoryPath + "\\" + masterDirectoryFileName);
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();

// Write the file to the server
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();

// Get a response from the server and display it in a text box
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
richTextBox2.Text += "Upload File Complete, status {0}" + response.StatusDescription;
response.Close();


Thanks for any insight you can provide!
AnswerRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
Pete O'Hanlon25-Jun-15 9:28
mvePete O'Hanlon25-Jun-15 9:28 
GeneralRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T25-Jun-15 12:07
DanDan_T25-Jun-15 12:07 
GeneralRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T26-Jun-15 5:29
DanDan_T26-Jun-15 5:29 
AnswerRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
Brisingr Aerowing25-Jun-15 19:48
professionalBrisingr Aerowing25-Jun-15 19:48 
QuestionHOw to solve input string was not in the correct format Pin
Siao Da25-Jun-15 4:50
Siao Da25-Jun-15 4:50 
AnswerRe: HOw to solve input string was not in the correct format Pin
Pete O'Hanlon25-Jun-15 4:58
mvePete O'Hanlon25-Jun-15 4:58 
GeneralRe: HOw to solve input string was not in the correct format Pin
Siao Da25-Jun-15 5:08
Siao Da25-Jun-15 5:08 
GeneralRe: HOw to solve input string was not in the correct format Pin
CHill6025-Jun-15 6:04
mveCHill6025-Jun-15 6:04 
QuestionDoes anyone experienced in the text-to-speech in C# WinForm ? Pin
goldsoft24-Jun-15 23:51
goldsoft24-Jun-15 23:51 
AnswerRe: Does anyone experienced in the text-to-speech in C# WinForm ? Pin
Mycroft Holmes24-Jun-15 23:56
professionalMycroft Holmes24-Jun-15 23:56 
AnswerRe: Does anyone experienced in the text-to-speech in C# WinForm ? Pin
Eddy Vluggen25-Jun-15 9:48
professionalEddy Vluggen25-Jun-15 9:48 
QuestionWhat to do if I want to return rows from different tables in ASP.NET WebService Pin
jasonalien24-Jun-15 22:41
jasonalien24-Jun-15 22:41 
AnswerRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
F-ES Sitecore25-Jun-15 0:02
professionalF-ES Sitecore25-Jun-15 0:02 
GeneralRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
jasonalien25-Jun-15 0:14
jasonalien25-Jun-15 0:14 
GeneralRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
F-ES Sitecore25-Jun-15 0:23
professionalF-ES Sitecore25-Jun-15 0:23 
Questionstoring result into byte[] Pin
Member 1171394224-Jun-15 21:04
Member 1171394224-Jun-15 21:04 
AnswerRe: storing result into byte[] Pin
Pete O'Hanlon24-Jun-15 23:50
mvePete O'Hanlon24-Jun-15 23:50 

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.