473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Unable to send client certificate to a web service

Not able to send client certificate to the web service. I am fetching x509certificate from the certificate store then adding the certificate to the web service object and trying to retrieve it on the web service end but clientcertificate.IsPresent is showing false. Here is the code for client side as well as server side.

/* client side code*/
Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.     {
  3.         X509Certificate2 cer = GetCertificate();
  4.         localhost.Service1 ser = new localhost.Service1();
  5.         ser.ClientCertificates.Add(cer);
  6.         ser.CreateUser();
  7.  
  8.  
  9.  
  10.     }
  11.  
  12.     private static X509Certificate2 GetCertificate()
  13.     {
  14.         X509Certificate2 cert = new X509Certificate2();
  15.         X509Store store = new X509Store("testCertStore", StoreLocation.CurrentUser);
  16.         store.Open(OpenFlags.ReadOnly);
  17.         X509Certificate2Collection certCol = (X509Certificate2Collection)store.Certificates;
  18.         foreach (X509Certificate2 x509 in certCol)
  19.         {
  20.             if (x509.SerialNumber == "23D91CD7E7114ABE4EEA208FB4868138")
  21.             {
  22.                 cert = x509;
  23.             }
  24.         }
  25.         return cert;
  26.     }
  27.  

/*server side code*/
Expand|Select|Wrap|Line Numbers
  1. X509Certificate2 cer = new X509Certificate2(Context.Request.ClientCertificate.Certificate);
  2.  
Thanks in advance for the help
Oct 19 '10 #1
0 1172

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Joey Edelstein | last post by:
Hi, We are trying to add a Client Certificate support for our web app that emulates a hardware device web app. The hardware uses a 2 factors authentication, which requires a Web Service client...
4
by: Matt Frame | last post by:
I am working on a special ASP.Net application that receives files from customers. The connection is made via HTTPS and the client sends the file as a POST to my ASP.Net listener. All of this...
1
by: Bob | last post by:
I'm building a .NET web service which requires client certificate for strong security. I set IIS to require SSL and client certificate (under site properties in IIS admin, Directory Security tab,...
1
by: Marvin | last post by:
my asp.net app is posting to another webpage using httpwebRequest & x509Certificates and in return the certificate's name used for the posting is sent back. But instead of getting information about...
1
by: Robson Carvalho Machado | last post by:
Dear friends, I'm creating an application that needs to ask users to show its Client Certificate. I've set IIS to use HTTPS and require client certificate, but when application runs the...
0
by: Koan B | last post by:
(Cross-posted to dotnet.framework.aspnet.webservices and dotnet.framework.webservices, follow-ups set to dotnet.framework.aspnet.webservices) Hi, I'm attempting to connect to a 3rd party web...
0
by: Priya | last post by:
Hi, Is there a way to validate client certificate in the web services by adding code to validate the certificate without having IIS to do anything?. We want to send a client certificate without...
3
by: jwillams77 | last post by:
I have searched extensively though Google and Experts Exchange and have not quite found the answer to this problem. Here is the scenario: I have a .NET 2.0 c# web service that is installed...
0
by: steveS | last post by:
Hi all, I'm having trouble connecting to a Java web service using HttpWebRequest. I get the error message "The request was aborted: Could not create SSL/TLS secure channel". The Java service...
3
by: mzarlenga | last post by:
I have a WCF .NET 3.0 self-hosted service and client. Both client and server are on the same system. My service opens a secure endpoint and is configured to demand a client-side certificate: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.