Hi, I am trying to install a .pfx certificate in personal folder using a C# application. Every thing goes fine and certificate is installed. I can see that certificate in the Personal folder of both Current User and Local machine. But when i try to run my application and use that certificate, it throws exception with the message: The credentials supplied to the package were not recognized Stack Trac at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)...... But when i import this cert manually, it works just fine. Below is the code i am using for installing the certificate: Dim cert_personal As X509Certificate2 = Nothing Try cert_personal = New X509Certificate2 cert_personal.Import(Application.StartupPath & "\Chain\Personal.pfx","My Password" , (X509KeyStorageFlags.UserKeySet Or X509KeyStorageFlags.Exportable)) Catch ex As Exception MsgBox(ex.Message) End Try If cert_personal Is Nothing Then Return False End If ''XXXXXXXXXXXXXXXXXXXXXXXX PERSONAL XXXXXXXXXXXXXXXXXXXXXXXXXXXXX Dim store As New X509Store(StoreName.My, StoreLocation.CurrentUser) Try store.Open(OpenFlags.ReadWrite) Dim findVal As String = cert_personal.Thumbprint 'Thumbprint Dim certColl As X509Certificate2Collection = store.Certificates.Find(X509FindType.FindByThumbprint, findVal, False) If certColl.Count <= 0 Then store.Add(cert_personal) End If Catch ex As Exception MsgBox(ex.Message) Finally store.Close() End Try
And almost same for installing in Local machine. The complete chain is also fine. But the problem is still there. I can't use CertMgr since this cert is from a third party which is not , as per my info, supported by that. Any suggestion, code sample, advice would be highly appreciated. Thanks in advance, Wasif Ehsan.
wasife
Posts
-
Installing Certificate using C# -
Synchronizing Data between SQL Express editions running on a networkHi, I have a number of SQL Server Express editions those are running on the same network. I want to synchronize the data on each instance with other instances on the network. The problem is that Full/Enterprise version of SQL Server is not allowed. Does anybody have any idea on how to do it? Any suggestion, component etc. Regards, Wasif Ehsan.
-
Getting GUID of a productHi, How can i get the GUID of a product which is installed on my system or of which i have the msi file. Regards, Wasif Ehsan.
-
passing data1. For the first task, you can capture any suitable event of the DataGridView in which you can get the content of the selected cell like CellClick etc 2. To pass back the data to MainForm There are many ways to do it. I choose the simplest one. Create public properties in Second form and while closing this form, set the values of those properties with the selected values. 3. To get the data passed from form2 When the form2 closes, read the public properties created in step2
-
Running a T-SQL script file using C#Hi, I have a T-SQL Script file which i want to run without opening it and reading its contents. Please tell me how can i do it using ADO.Net or any other way. Regards, Wasif Ehsan.
-
installer packageYou can make its installer by creating a setup project in Visual Studio. Or you can add another project of type Setup Wizard in the same solution which is a bit easier way. Then there is InstallShield which you could use. There are many many ways to create an installer. On google, search how to create setup projects in Visual Studio.
-
Running a SQL Script file using C#Hi, I have a T-SQL script file which i want to run using C#. Can any body please tell me how can i do it? Regards, Wasif.
-
Displaying data in two grids from three tablesDear All, I have two grids g1 and g2 and three tables t1,t2,t3. Basically there are only two tables t1 & t3 which have many to many relationship between them for which i have created t2. I want to show the data of t1 in g1 and data of t3 in g2 based on selected row of g1. Can any body tell me how can i do this? Currently i have created two relationships dr1 (between t1 & t2) and dr2 (between t2 & t3) and have databinding like this: g1.DataSource=t1; g2.DataSource=t1; g2.DataMember="dr1.dr2"; This scheme shows the data in g2 but not all the relevant rows in g2 are displayed. Instead just a single row against one row in g1 is displayed. Kindly give me some guidance in this regard. Regards, Wasif Ehsan.
-
Ribbon ControlWhere? How Much? Kindly give me your hotmail address so that i could add you in MSN Messenger Regards, Wasif Ehsan.:rose:
-
Ribbon ControlI am talking about whether it is available for us the developers or not. I know it is used in Office 2007 but i need to use it myself.
-
Ribbon ControlHi, Can any body tell me whether Ribbon Control is available from Microsoft or not? If not, then which company's Ribbon control is most stable and reliable? Since i have downloaded some which generate exceptions are they are not fully functional. Thanks in Advance.... Wasif Ehsan, Pakistan.
-
Resolution Independent Desktop ApplicationHi, I am making a desktop application. The main problem i am facing is that its GUI affects adversely system resolution is changed. Can any body tell me how can i make resolution independent application? I have already seen many ready made components but we are not yet final what to use. Any kind of link, suggestion and specially expert advice would be highly appreciated. Thanks in advance... Wasif Ehsan.
-
Sharing a folder with users programmaticallyHi, I have a windows application in which the user selects a folder. I want to share this folder and make it availabe to all other users on the network with full rights. Can any body tell me how to do it? I want it done the .Net way not using the Calc.exe or System.Management or any other crude way? I have googled very much but no +ve response. Waiting for your reply... Regards, Wasif Ehsan.
-
How to get the instance of a running process ?You can get the instance of currently running thread through System.Threading.Thread.CurrentThread but i dont think you can call its members a thread may contain several classes, functions etc. So i am not very much optimistic. You can dig deeper into that... Regards, Wasif Ehsan.
-
Form does not showHi, I have an application in which there there is an MDI form and all other are its child. But when i try to show one specific form as its child, it does not appear. And also its Load event also does not fire. This form gets appeared from one location but not from any other location. Can you please give me hint why it is so? Your help would be highly appreciated. Regards, Wasif Ehsan.
-
Icon for Alt+TABNo sir. Its showing in the taskbar. Even it is showing the icon associated with its exe but the Icon on Alt+Tab is not showing.
-
Icon for Alt+TABHi, I have a C# Desktop solution in which there are many projects. When i press Alt+TAB to switch between other opened application, there is no icon displayed against my running application. Please guide me how can i set it for my application. Regards, Wasif Ehsan.
-
I want to set my Windows form as "Always on Top" andSet the form's TopLevel property to True. Regards, Wasif Ehsan.
-
How to import "user32.dll'' from C# application [modified]You need to use something like this: [DllImport("user32.dll")] < Declaration of function in user32.dll to be used here preceded by static extern > You have to declare each function you want to use in C# code in the above manner.Moreover you should write this code where you are declaring other variables of your class which is normally at the start of the class. After that you can use those functions in your C# code. Keep in mind that all the types used while declaring function prototypes must be C# types and must not contains Win32 or other languages types. Regards, Wasif Ehsan.
-
How to resolve the remote host name from IP address? [modified]I think you should use
System.Net.Dns.GetHostByAddress(String address)
Regards, Wasif Ehsan.