Sample code for 30+ languages & platforms
Classic ASP

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set cert = Server.CreateObject("Chilkat.Cert")
success = cert.LoadByCommonName("Chilkat Software, Inc.")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( cert.SubjectDN) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "Success.") & "</pre>"

%>
</body>
</html>