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

C#

 
QuestionTypeInitializationException was unhandled? Pin
dec8218-Dec-08 16:19
dec8218-Dec-08 16:19 
AnswerRe: TypeInitializationException was unhandled? Pin
PIEBALDconsult18-Dec-08 16:32
mvePIEBALDconsult18-Dec-08 16:32 
QuestionN-Tier DataTable Validation... Pin
Illegal Operation18-Dec-08 12:16
Illegal Operation18-Dec-08 12:16 
QuestionHow to handle errors right? Pin
skyline9218-Dec-08 11:39
skyline9218-Dec-08 11:39 
AnswerRe: How to handle errors right? Pin
Christian Graus18-Dec-08 11:45
protectorChristian Graus18-Dec-08 11:45 
AnswerRe: How to handle errors right? Pin
Expert Coming18-Dec-08 11:47
Expert Coming18-Dec-08 11:47 
AnswerRe: How to handle errors right? Pin
led mike18-Dec-08 12:21
led mike18-Dec-08 12:21 
QuestionHttpWebRequest with Client certs Pin
kicknit218-Dec-08 11:15
kicknit218-Dec-08 11:15 
We currently have a Webmethods Integration Server that sends and recieves XML from a customer and saves it to a file. I am trying to do the same thing using C#.NET 3.5. I am currently working on the sending.

I am using an HttpWebRequest to the secure site which requires a Client cert. The customer has provided us with a cert with a public key and their CA cert. I am trying to load these from the file and attach them to stream as I have seen in several tutorials as shown below:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
            req.ClientCertificates.Add(AEXCert);
            ServicePointManager.CertificatePolicy = new CertPolicy();
            GlobalProxySelection.GetEmptyWebProxy();
            req.PreAuthenticate = false;
            req.Method = "POST";        // Post method
            req.ContentType = "text/xml";// content type
            req.KeepAlive = false;
            req.UserAgent = null;
            StreamWriter writer = new StreamWriter(req.GetRequestStream());
            TextReader reader = new StreamReader(e.FullPath);
            String XML = reader.ReadToEnd();
            reader.Close();
            writer.WriteLine(XML);
            writer.Flush();
            writer.Close();
            WebResponse rsp = req.GetResponse();//<----Error happens here----

I am getting an error "The request was aborted: Could not create SSL/TLS secure channel." at the line commented above.
I'm new to SSL so I have a few questions.
1. Do I need a client cert with a private key? Obviously it works with the given certs in webmethods which is written in Java.
2. Do I need to add the certificates to the machine store with the user? If so what user and how would I go about that.



Thanks in advance,
-CALE
Questionconnecting to sqlConnection after restarting SQL server process fails Pin
calanit18-Dec-08 10:06
calanit18-Dec-08 10:06 
AnswerRe: connecting to sqlConnection after restarting SQL server process fails Pin
Dave Kreskowiak18-Dec-08 10:15
mveDave Kreskowiak18-Dec-08 10:15 
GeneralRe: connecting to sqlConnection after restarting SQL server process fails Pin
calanit18-Dec-08 10:27
calanit18-Dec-08 10:27 
QuestionRe: connecting to sqlConnection after restarting SQL server process fails Pin
led mike18-Dec-08 10:29
led mike18-Dec-08 10:29 
AnswerRe: connecting to sqlConnection after restarting SQL server process fails Pin
calanit18-Dec-08 10:40
calanit18-Dec-08 10:40 
GeneralRe: connecting to sqlConnection after restarting SQL server process fails Pin
Dave Kreskowiak18-Dec-08 10:45
mveDave Kreskowiak18-Dec-08 10:45 
GeneralRe: connecting to sqlConnection after restarting SQL server process fails Pin
calanit18-Dec-08 11:03
calanit18-Dec-08 11:03 
QuestionGet rid of label margins Pin
Tony Pottier18-Dec-08 8:23
Tony Pottier18-Dec-08 8:23 
AnswerRe: Get rid of label margins Pin
#realJSOP18-Dec-08 8:33
mve#realJSOP18-Dec-08 8:33 
AnswerRe: Get rid of label margins Pin
Dave Kreskowiak18-Dec-08 8:33
mveDave Kreskowiak18-Dec-08 8:33 
GeneralRe: Get rid of label margins Pin
Tony Pottier18-Dec-08 8:43
Tony Pottier18-Dec-08 8:43 
GeneralRe: Get rid of label margins Pin
Dave Kreskowiak18-Dec-08 9:04
mveDave Kreskowiak18-Dec-08 9:04 
GeneralRe: Get rid of label margins Pin
Tony Pottier18-Dec-08 9:06
Tony Pottier18-Dec-08 9:06 
GeneralRe: Get rid of label margins Pin
Tony Pottier18-Dec-08 9:37
Tony Pottier18-Dec-08 9:37 
GeneralRe: Get rid of label margins Pin
Tony Pottier18-Dec-08 9:58
Tony Pottier18-Dec-08 9:58 
GeneralRe: Get rid of label margins Pin
DaveyM6918-Dec-08 11:21
professionalDaveyM6918-Dec-08 11:21 
GeneralRe: Get rid of label margins Pin
Tony Pottier18-Dec-08 11:27
Tony Pottier18-Dec-08 11:27 

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.