Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
GeneralRe: Securing Software Pin
Stick^4-Aug-06 23:35
Stick^4-Aug-06 23:35 
GeneralRe: Securing Software Pin
Christian Graus4-Aug-06 23:45
protectorChristian Graus4-Aug-06 23:45 
QuestionHow to host a socket server Pin
vik204-Aug-06 20:12
vik204-Aug-06 20:12 
Questionhow to convert float value to time? Pin
Nagraj Naik4-Aug-06 19:44
Nagraj Naik4-Aug-06 19:44 
AnswerRe: how to convert float value to time? Pin
Expert Coming4-Aug-06 21:09
Expert Coming4-Aug-06 21:09 
QuestionHow to assign a specific value to all the array elements at the time of initilization? Pin
signbit4-Aug-06 19:29
signbit4-Aug-06 19:29 
AnswerRe: How to assign a specific value to all the array elements at the time of initilization? Pin
Stefan Troschuetz4-Aug-06 21:46
Stefan Troschuetz4-Aug-06 21:46 
QuestionInvalid certificate [modified] Pin
stellasworkinc4-Aug-06 17:35
stellasworkinc4-Aug-06 17:35 
Hi I'm not sure if I should post here but I'm using C# so I guess it goes here.
Anyways, I'm making a windows application that will access an FTP server over ssl.
I've already enabled SSL on the server and created a certificate.
I've also authenticated this certificate so that the FTP server recognizes it.
I've also added the certificate to my code, and it identifies that the FTPWebRequest request
has added it by the 'request.ClientCertificates.Count'.

Unfortunately, when I run my program, I get this error:
The remote certificate is invalid according to the validation procedure.

Can anyone please help me?:Sigh | :sigh:

Here's a snippet of my code:
X509Certificate certificate = new X509Certificate(@"C:\Program Files\Code-Crafters\Ability FTP Server\certs\Sync Testing Certificate.crt");

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(_uploadURI);
            request.EnableSsl = true;
            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.UsePassive = false;

            request.Credentials = new NetworkCredential(_username, _password);
            request.ClientCertificates.Add(certificate);
            Console.WriteLine("Number of Certificates: {0}", request.ClientCertificates.Count);
            
        
            try
            {
                // Copy the contents of the file to the request stream.
                StreamReader sourceStream = new StreamReader(_filepath);
                byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
                sourceStream.Close();

                request.ContentLength = fileContents.Length;
                Stream requestStream = request.GetRequestStream();<font color=red>//<--This is where the error occurs</font>
                requestStream.Write(fileContents, 0, fileContents.Length);
                requestStream.Close();

                FtpWebResponse response = (FtpWebResponse)request.GetResponse();

                Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
            }
            catch (WebException e)
            {
                FtpWebResponse res = (FtpWebResponse)e.Response;
                string error = res.StatusDescription;
                Console.WriteLine(error.ToString());
            }



-- modified at 23:37 Friday 4th August, 2006

Still learning...

QuestionDear Expert .. Problem with Thread Pin
Aldorado4-Aug-06 12:54
Aldorado4-Aug-06 12:54 
AnswerRe: Dear Expert .. Problem with Thread Pin
Rob Graham4-Aug-06 16:18
Rob Graham4-Aug-06 16:18 
GeneralRe: Dear Expert .. Problem with Thread Pin
Aldorado5-Aug-06 21:28
Aldorado5-Aug-06 21:28 
GeneralRe: Dear Expert .. Problem with Thread Pin
Rob Graham7-Aug-06 5:45
Rob Graham7-Aug-06 5:45 
QuestionA new type of number incrementor.... perhaps? Pin
CAgent0074-Aug-06 12:08
CAgent0074-Aug-06 12:08 
AnswerRe: A new type of number incrementor.... perhaps? Pin
Guffa4-Aug-06 12:15
Guffa4-Aug-06 12:15 
GeneralRe: A new type of number incrementor.... perhaps? Pin
CAgent0075-Aug-06 10:52
CAgent0075-Aug-06 10:52 
QuestionRe: A new type of number incrementor.... perhaps? Pin
CAgent0076-Aug-06 11:27
CAgent0076-Aug-06 11:27 
AnswerRe: A new type of number incrementor.... perhaps? Pin
Leslie Sanford4-Aug-06 16:01
Leslie Sanford4-Aug-06 16:01 
QuestionTimers Pin
SoftcodeSoftware4-Aug-06 10:51
SoftcodeSoftware4-Aug-06 10:51 
AnswerRe: Timers Pin
Not Active4-Aug-06 11:11
mentorNot Active4-Aug-06 11:11 
GeneralRe: Timers Pin
SoftcodeSoftware4-Aug-06 11:16
SoftcodeSoftware4-Aug-06 11:16 
GeneralRe: Timers Pin
Dave Kreskowiak4-Aug-06 11:53
mveDave Kreskowiak4-Aug-06 11:53 
GeneralRe: Timers Pin
SoftcodeSoftware4-Aug-06 12:22
SoftcodeSoftware4-Aug-06 12:22 
GeneralRe: Timers Pin
Dave Kreskowiak4-Aug-06 16:18
mveDave Kreskowiak4-Aug-06 16:18 
AnswerRe: Timers Pin
eggie55-Aug-06 20:51
eggie55-Aug-06 20:51 
QuestionString into resource? [modified] Pin
SoftcodeSoftware4-Aug-06 10:30
SoftcodeSoftware4-Aug-06 10:30 

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.