Last post Jul 25, 2017 01:17 PM by JBetancourt
Jul 24, 2017 11:47 AM|tapan2017|LINK
i got a example from this url
code supposed to add client side certificate when calling web service from client side
public void CallWebService()
// TODO: Replace <C:\WSClientCert.cer> with the path of your certificate file.
string certPath = @"<C:\WSClientCert.cer>";
// Create an instance of the Web service proxy.
WebSvc.math mathservice = new WebSvc.math();
// TODO: Replace <https://wsserver/securemath/math.asmx> with a valid URL.
mathservice.Url = @"<https://wsserver/securemath/math.asmx>";
// Create an X509Certificate object from the information
// in the certificate export file, and then add the certificate to the
// ClientCertificates collection of the Web service proxy.
long lngResult = 0;
lngResult = mathservice.Add(Int32.Parse(operand1.Text),
string result = lngResult.ToString();
if(ex is WebException)
WebException we = ex as WebException;
WebResponse webResponse = we.Response;
throw new Exception("Exception calling method. " + ex.Message);
see this line string certPath = @"<C:\WSClientCert.cer>";
1) tell <> bracket is required when store cert file path?
2) from where to get certificate?
3) do i need to purchase certificate to call service from client side ?
4) suppose if i purchase certificate from x company then how web service can understand my certificate ?
guide and answer for my all points.
Jul 24, 2017 07:20 PM|JBetancourt|LINK
you can create a self signed certificate with makecert (no need to purchase a real certificate)
see this microsoft article for the whole explanation:
Jul 25, 2017 09:50 AM|tapan2017|LINK
your answer is not as per my question.
Jul 25, 2017 01:17 PM|JBetancourt|LINK
1.- no need for brackets but a normal file path like:
string certPath = @"C:\WSClientCert.cer"
2.-use makecert to create a self signed certificate as explained in the article I sent you the link
3.- no, make your own self signed certificate
4.- follow the steps in the turorial I sent you when you create your client certificate(step 7) you do it using the root CA certificate known by the server (step3)