.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to read SSL certificate information using C#

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :Windows Application

Could someone show me how to read SSL certificate information, such as Expire Date using C#?

I would like to retrieve all the SSL certificate Expire Date, and save them  to a file for future email notification process    


Thanks in advance,


View Complete Post

More Related Resource Links

Getting client information from X.509 certificate in C# code

I have a WCF service which accepts X.509 certificate signed incoming messages. As per my understanding the client will send the message with signature encrypted using his private key and web services will decrypt the signature with client's public key. This ensures that the sender of the message is holder of the private key and that he is certified by the server trusted CA as "He is what he claims to be". It's being a highly secure application I need to give access to only certain clients regardless of whether they are trusted or not. (This is to take care of good turned bad scenario :-)) How do I achieve this? Is there any way to get the client information as subject name etc from his certificate in C# code? Is there any example of this usage? Thanks in advance,Jeet.    

Reading Certificate information in Windows Service

Hi, I have created windows service application, While starting the service i try to get the user certificate information using follwoing code. It is return nothing. but when i try to call the same set of code using windows application it returns the certificate. Can you provide any suggestion on why Windows service call not returning the certificate information. How we can get the certificate information in windows service application.     Dim matchedCertificate As X509Certificate2 = Nothing     Dim store As New X509Store(searchConfig.StoreName, searchConfig.StoreLocationEnumValue) store.Open(   OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)     Dim matchedCertificates As X509Certificate2Collection = CType(store.Certificates, X509Certificate2Collection)     Dim findValue As Object     ' Apply all search criterias     For Each searchCriteria As SearchCriteria In searchConfig.SearchCriteria     ' Resolve tokens in findValue findValue = ResolveTokens(searchCriteria.FindValue) matchedCertificates =   DirectCast(matchedCertificates.Find(searchCriteria.FindTypeEnumValue, findValue, False), X509Certificate2Collection)       Trace.WriteLine(String.Format("Found {0} certs with search criteria {1}={2}", matchedCertificates.Count, s

read and print sharepoint list information using javascript



i am working on a form right now, user's inputs will be stored in a sharepoint list. after user click submit, it will display a thankyou panel, and send a email to me showing user's input. on the thankyou panel, there is a button, if user click it, it will open a new window and display exactly the same thing in email, so that user can check if they input the right thing.

i did this part using javascript, the window.open method. and i wrote html code in it, using window.document.write method.

i wrote a read from sharepoint list function, i dont know if it is working, but my question is how can i call this function in javascript since it will be a client side programming.

my readfromlist code is here:

public void readFromList()
             SPSite oSiteCollection = SPContext.Current.Site;
             SPList oList = oSiteCollection.AllWebs["something"].Lists["somelist"];
             SPView oListView = oList.Views["All Items"];
             SPListItemCollection collectListItems = oList.GetItems(oListView);

             foreach (SPListItem oListItem in collectListItems)
                 txtFirstName.Text = SPEncode.HtmlEncode(oListItem["First Name"].ToString()) + "<BR>";

Get Remote SSL Certificate Information


Hi All,

I am looking to get the data from any given domain names SSL certificate. For example I want to put in any website address e.g. "www.asp.net" and my code would firstly check if an SSL certificate exists. If it does then I want it to pull out the Issuer, Subject, Valid From and Valid Until etc. The intention is to create an SSL certificate checker similar to this: http://www.digicert.com/help/

How can I do this ASP.net???? - I have looked up loads of different things such as RequestCertificateValidationCallback and ClientCertificates etc.

I could be completely wrong (hence why I need help) but would I create a HTTPWebRequest and then somehow request the client certificate and specific elements that way?

Any help would be much appreciated - Thank you.

How to get more information about the exceptions that can happen in SharePoint 2010 projects?

In case there is an exception anywhere in the SharePoint 2010 project (most common place an exception would happen is during deployment of your SharePoint project, custom deployment configuration or custom deployment steps), there's a registry key EnableDiagnostics available for you to use.

Serial Port Communication Read and Write using C#.net

In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
using System.IO.Ports

Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

Scripts not read when in head tag


I just upgraded to VS2010 if that matters.  I'm learning JQuery and noticed that scripts don't work if they're in the head tag.  Also, I need the script tag with type="text/javascript" in the head (with nothing else) in order for the JQuery scripts in the body to work.

Very bizzare, any suggestions?

With a separate script tag in the <body> with my JQuery script, this works

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
<script type="text/javascript">

This doesn't:

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />

Information about sessions


Some questions about sessions:

I know sessions information is stored in the form of cookie and you can use qurystring for that if you set cookieless session in web.config. But I don't exactly understand the scope of a session.

What I believe is when you login to a website, a session cookie is created and the scope of that session is within that page only. If you close the browser that session gets killed and when you open the browser again and go to that site then a new session is created ie a new session is created on every request. Is this correct?

But I have seen in many websites, even if you close the browser and open it again the session is not killed, how does that happen?

Can anyone clear out and explain the scope/lifetime of sessions


I am not able to read xml file with XDocument if its Descendants has Attribute xmlns="http://abc.co


I am not able to read xml file with XDocument if its Descendants has  Attribute like:-

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <row ID="1" xmlns="http://www.opentravela.org/OTA/2003/05">
    <var country_name="Caribbean and Rest of the world" city_name="Kingston" flight_category="Economy Class" via="Atlanta" flight_departure="London Heathrow" airline_logo="Delta" adult_fare="Delta" child_fare="660" infant_fare="561" date1="132" date2="2010-08-15" />


I don't know what to do ?

Looking for some help..

How to read XML using LINQ in VB.NET


Can someone please tell me (sample code) how to read this XML into a SQL DB?  Should I use LINQ to XML?  Does anyone have any sample code?  I am working in VB.NET


<?xml version="1.0" encoding="utf-8"?>

<ReadOrderResponseType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<Status xmlns="urn:mysol:apis">Success</Status>

<TimeStamp xmlns="urn:mysol:apis">2010-07-25T15:26:49.1150235Z</TimeStamp>

<StoreUrl xmlns="urn:mysol:apis">http://xyz.COM</StoreUrl>

<PageResponse xmlns="urn:mysol:apis">




Read Excel file from Web Application (C#)



I have a web app where user uploads a file.

File is saved in server locally and I want to read some data from it.

Currently my development  server has office 2003.

So do I need office 2007 in order to be able to  read an excel from office 2007 ?

What are other requirements  ?

I tried a test, using

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wrkBook; // = new Microsoft.Office.Interop.Excel.Workbook();

wrkBook = excelApp.Workbooks.Open(@"C:\www\excel_files\b.xls", ....);

But When trying to open the file I get the error:

Exception from HRESULT: 0x800A03EC

So I'm wondering what I'm missing.


How to read value of CheckBox in EXCEL sheet


I am using OLEDBConnection (@"Provider=Microsoft.ACE.OLEDB.12.0;") to connect to the EXCEL file and read contents. When I read the contents, I get all the contents from the excel sheet but i dont get contents for checkboxes placed inside.

My Excel sheet contains set of checkboxes and I need to know If they are checked or not.These checkboxes are controls which are added from Developer tab in EXCEL.

I dont want to use Excel Assemblies for reading contents as it is not recommended. And also i am using OLEDBconnection and want to stick to this .

Awaiting replies from you guys. Thanks in Advance.

ERROR [HY000] [Informix .NET provider][Informix]Database locale information mismatch


Hi, there is an upgrade to my infimacs server and my web application encounter this error after the infimacs is upgraded.

Below is the information on the server before/after the upgrade.

Before            After

---------       -----------  

Solaris 8      Solaris 10

IDS 9.40     IDS 11.50

The web server where the web application hosted is running IBM Informix Connect 2.81. There is no such error before the upgrade is done.

As a developer, i have IBM Informix Client-SDK 2.90 installed on my local pc and debug the page where the read is needed from infimacs but no such error found.

The error come out only when it is hosted on the web server where IBM Informix Connect 2.81 is installed.

I have gone through many articles and it suggest me to set the environement  variable in the server :  DB_LOCALE=en_us.819.

I haven't try this solution but i think that this might not be the best solution.

Is it possible to to to have this settin

How to read Excel table?


If I  use Microsoft.Jet.OLEDB.4.0 to retreive for example named range or sheet from Excel and use it as data source for some server control on the ASP page, everything works fine. But when I try to get table from Excel like this: "select * from [Table1]", debugger complains that database engine could not find object Table1. So how should I reference Table1 in Excel file so that the database engine could find it?

How to send an email with information in query string


First I will say I googled (Binged to make Bill happy) for this but could not find anything, perhaps I am not stating what I need correctly;

I have a website that a customer creates orders (for a printing company) and after the order, I would like to email the customer a link to view the status of their order;

I need to send the CustomerID in the link so on the returning page if a CustomerID is detected in the querystring, I "auto login" the client and open the "Dashboard" for the order page for that customer.

Can anyone point me in the right direction as to how to send the link and how to parse the querystring to get the values from the link;

Thank you if you can point me in the right direction.

How to read the custom http header



I have just joined the forum. I have a very simple query. I have added custom header to my website. Now I want to read the custom header. I am using IIS 6.0 on windows XP. I have already tried using using the Request.ServerVariables and and Request.header method. But none of them give me the custom header added to website.

Can any body help?

Thanks a lot in advance



Can't read global resource in asp button


I have translated Text Ok in arabic and I have that placed in global Navig.resx file

<asp:Button ID

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend