十万火急求助!!!明天考试用的
为明天考试写了一段ASP代码(见下文),可是同学都说是FOXPRO代码,不是ASP代码。郁闷啊!!!!紧急求助各路神仙,这到底是不是啊?如果真的不是的话,可否帮我改一改???泣血求助!!!!
通过CAPICOM 的Certificate 对象来访问库,因为CAPICOM 的Certificate 对象支持HTTP 协议访问证书库。Certificate 对象主要包含一个独立的数字证书。其属性主要是证书版本、系列号、被颁发者名称、颁发者名称、有效日期等证书参数。主要用它的import 方法来导入一个证书。
1.将GetCertificate 获取的证书,用CAPICOM.Certificate 来读入
Dim Cert
Set Cert = Server.Createobject (“CAPICOM . Certificate”)
Cert.lmport ( sCertificate )
2.将CAPICOM.certificate 读入的内容,和获取的证书全文,使用ADO 存入设计的SQL server 数据库.
主要代码如下:
if Err.Number=0 then
Set conn = Server.Createobject ( “ADODB.Connection“ )
Conn.open “drive”={SQLServer}; server = TRACY ; uid = sa ; pwd = ; database = certificate ; "
IF Err.Number = 0 then
dim sql
sql = " insert into issued ( Version , SerialNumber , SubjectName , IssuerName , ValidFromDate , ValidToDate , Certificate )
values ( " sql = sql & Cert.Version "
sql = sql & ", " " & left ( Cert . SerialNumber , 20 ) & " " "
sql = sql& ", " " &Cert . SubjectName & " " "
sql = sql & ", " " &Cert . lssuerName & " " "
sql = sql & ", " " &Cert . ValidFromDate & " " "
sql = sql& ", " "&Cert . ValidToDate & " " "
sql = sql & ", " " &Cert.Certificate & " " ) "
conn .Execute sql
Conn. Close
END IF
Set conn=nothing
End If
Set Cert = Nothing
3.查询数据库
当连结数据库Certificate成功后从页面中获取商家证书的系列号到参数SerialNumber 中
IF Err.Number < > 0 THEN
Response.Write " 没有符合的证书 "
ELSE
dim sql , SerialNumber , rs
Seria1Number=Request ( " SerialNumber " )
使用ADO 技术根据SerialNumber 从数据库中查找该商家证书
IF SerialNumbe= " " THEN
Response . Write "NO VALID CERTIFICATE FOUND "
ELSE
sql = " select Certificate , ValidFromDate , ValidToDate from issued where SerialNumbe = " " & SerialNumber & " "
set rs = conn.Execute ( sql )
4.若查找成功,从数据库中读取字段:证书、有效起始时间、结束时间到参数中,可以通过查看证书的起/止时间来判断证书是否过期。
IF rs.BOF or rs.EOF THEN
ResPonse . Write " NO VALID CERTIFICATE FOUND "
ELSE
dim sCertificate , BeginTime , EndTime , MyTime
sCertificate = rs.Fields ( 0 ).Value
BeginTime = rs.Fields ( l ).Value
EndTime = rs . Fields ( 2 ).Value
[解决办法]
你同学是火星来的么?
[解决办法]
标准的VBScript代码,呵呵
[解决办法]
从语法上看确实是asp代码,但是证书没有接触过无法帮楼主解释正确性了