Griaule Biometrics

Home » Forums » FINGERPRINT SDK » Other Programming Languages » ASP y GrFinger SDK 2007
15 replies [Last post]
gebope
Offline
Joined: 2010-11-22
Rate this post:
0
No votes yet
ASP y GrFinger SDK 2007

Buenos días,

Tengo una aplicación en ASP donde quiero identificar huellas registradas en una BD Sql Server 2005, el registro de las huellas se hizo con una aplicación en VB 6.0, pero la identificación debo hacerla en ASP.

Hice el código para el lado del cliente con un html y para el lado del servidor con un js, sinembargo al abrir la página para identificar, no me enciende el lector, el que estoy usando es un Lector de Huellas Microsoft, y está bien instalado porque desde la aplicación en VB 6.0, se activa, aparentemente es como si no leyera los eventos en el html.

Agradezco de antemano la ayuda que puedan brindarme.

lo hice así:
<script FOR="GrFingerX" EVENT="SensorPlug(id)" LANGUAGE="javascript"> GrFingerX.CapStartCapture(id); document.getElementById('log').value =""; document.getElementById('log').value = document.getElementById('log').value + "Iniciado\n"; document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; </script><script FOR="GrFingerX" EVENT="SensorUnplug(id)" LANGUAGE="javascript"> GrFingerX.CapStopCapture(id); document.getElementById('log').value = document.getElementById('log').value + "Detenido\n"; document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; </script><script FOR="GrFingerX" EVENT="FingerDown(id)" LANGUAGE="javascript"> document.getElementById('log').value = document.getElementById('log').value + "Dedo Ubicado\n"; document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; </script><script FOR="GrFingerX" EVENT="FingerUp(id)" LANGUAGE="javascript"> document.getElementById('log').value = document.getElementById('log').value + "Dedo levantado\n"; document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; </script><script FOR="GrFingerX" EVENT="ImageAcquired(id, w, h, rawImg, res)" LANGUAGE="javascript"> GrFingerX.CapSaveRawImageToFile(rawImg, w, h, "C:\teste.bmp", 501); Start(); if(document.getElementById('img').style.display == 'none') document.getElementById('img').style.display = 'block'; CallIdentify(rawImg, w, h, res); </script>

JB
Offline
Joined: 2010-09-15
Rate this post:
0
No votes yet

Estimado cliente,

¿Qué error le sale en la función startcaputure o initialize?

 

Jan Beeck

Griaule Support Team

gebope
Offline
Joined: 2010-11-22
Rate this post:
0
No votes yet

Hola, gracias por responder, ayer encontré mi error y era realmente una tontería, creo que sin querer borré el ";" que iba en el var de la ruta del sitio, y por eso no hacía nada.

Gracias.

erick.c
Offline
Joined: 2008-12-16
Rate this post:
0
No votes yet

hola gebope : llevo dias investigando como poder realizar lo que tu ya lograstes. queria pedirte de favor si me puedes indicar como hacer o alguna documentacion.

Gracias.

gebope
Offline
Joined: 2010-11-22
Rate this post:
0
No votes yet

El html quedó así:

<html>
<head>
<script LANGUAGE=javascript src="GrFinger.js"></script>
</head>

<body onbeforeunload="Finalize()" onload="Initialize()">

<OBJECT ID="GrFingerX" CLASSID="CLSID:71944DD6-B5D2-4558-AD02-0435CB2B39DF"></OBJECT>

<SCRIPT FOR="GrFingerX" EVENT="SensorPlug(id)" LANGUAGE="javascript">
GrFingerX.CapStartCapture(id);
document.getElementById('log').value ="";
document.getElementById('log').value = document.getElementById('log').value + "Iniciado\n";
document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
</SCRIPT>

<SCRIPT FOR="GrFingerX" EVENT="SensorUnplug(id)" LANGUAGE="javascript">
GrFingerX.CapStopCapture(id);
document.getElementById('log').value = document.getElementById('log').value + "Detenido\n";
document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
</SCRIPT>

<SCRIPT FOR="GrFingerX" EVENT="FingerDown(id)" LANGUAGE="javascript">
document.getElementById('log').value = document.getElementById('log').value + "Dedo Ubicado\n";
document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
</SCRIPT>

<SCRIPT FOR="GrFingerX" EVENT="FingerUp(id)" LANGUAGE="javascript">
document.getElementById('log').value = document.getElementById('log').value + "Dedo levantado\n";
document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
</SCRIPT>

<SCRIPT FOR="GrFingerX" EVENT="ImageAcquired(id, w, h, rawImg, res)" LANGUAGE="javascript">
GrFingerX.CapSaveRawImageToFile(rawImg, w, h, "C:\\teste.bmp", 501);
Start();
if(document.getElementById('img').style.display == 'none')
    document.getElementById('img').style.display = 'block';
CallIdentify(rawImg, w, h, res);
</SCRIPT>

<input type = "button" value = "Identify" onclick = "identify()" />

<br />

 <IMG id="img" style="display: block; background-color: powderblue; visibility: visible; clear: right; border-top-style: dotted; border-right-style: dotted; border-left-style: dotted; border-bottom-style: dotted;" name="refresh">
      <SCRIPT language="JavaScript" type="text/javascript">
      function Start() {
      document.getElementById("img").src = "C:\\teste.bmp?ts" + encodeURIComponent( new Date().toString() );  
      }
      </SCRIPT>
<br />

<textarea name="log" id = "log" style="width: 286px; height: 93px" ></textarea>

</body>

</html>

erick.c
Offline
Joined: 2008-12-16
Rate this post:
0
No votes yet

y el js del lado del servidor como queda, una pregunta el control donde va en el lado del cliente o en el servidor?

erick.c
Offline
Joined: 2008-12-16
Rate this post:
0
No votes yet

Gracias man.

gebope
Offline
Joined: 2010-11-22
Rate this post:
0
No votes yet

El control tiene que ir del lado del cliente. Debes tener un asp que es el código para servidor y el js queda:

var url_server="http://rutadelsitio";
var GrFingerX ;

//Initializes the Fingerprint SDK library and the Capture
function Initialize() {
    try
    {
    GrFingerX = document.getElementById('GrFingerX');
    GrFingerX.Initialize();
    GrFingerX.CapInitialize();
    }
    catch (e)
    {
    alert(e);
    }
}

//Finalizes the Fingerprint SDK library
function Finalize() {
    GrFingerX = document.getElementById('GrFingerX');
    GrFingerX.Finalize();   
}

/*   
    Writes the appropriate message on the log based on the identification
*/
function post_identify(Objpost){
    if(Objpost.ret == 0){
            document.getElementById('log').value = document.getElementById('log').value + "No se encontró\n";
            document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
        }
        else if(Objpost.ret == 1){
            document.getElementById('log').value = document.getElementById('log').value + "Identificado con id = " + Objpost.id + "\n";
            document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
        }
        else{
            document.getElementById('log').value = document.getElementById('log').value + "Error = " + Objpost.ret + "\n";   
            document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
        }
}

/*
    Communicates with the appropriate php page that execute the identification.
*/

function post(tpt,id_ref)
{
    var http = new ActiveXObject("Microsoft.XMLHTTP");
    var url;
    url    = url_server + "identify.asp";
    var params;

    if(id_ref == 0)
        params = "tpt="+encodeURIComponent(tpt);
    else
        params = "tpt="+encodeURIComponent(tpt)+"&id="+id_ref;
       
    http.open("POST", url, true);
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");
    http.onreadystatechange = function() {    //Call a function when the state changes
        if(http.readyState == 4 && http.status == 200)
        {
            alert(http.responseText);
            var Objpost = eval('(' + http.responseText + ')'); //Adaptate the return to an Object form
            post_identify(Objpost);
        }
        else
        {
            alert(http.status);
        }
    }
    http.send(params);
}
/*
    Extracts the template of the image and calls the function responsable for the Identification
*/
function CallIdentify(rawImg, w, h, res){
    try
    {
    GrFingerX = document.getElementById('GrFingerX');
    var result = GrFingerX.ExtractJSON(rawImg, w, h, res, GrFingerX.GR_DEFAULT_CONTEXT,GrFingerX.GR_FORMAT_DEFAULT); //
    var Objret = eval('(' + result + ')');    //Adaptate the return to an Object form
    var ret = GrFingerX.FreeJSON(result);
    if(Objret.ret < 0){
        document.getElementById('log').value = document.getElementById('log').value + "Extract Error = " + Objret.ret + "\n";
        document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
        }
    else {
        post(Objret.tpt,0);
        }
    }
    catch(e)
    {
        alert(e);
    }
}

erick.c
Offline
Joined: 2008-12-16
Rate this post:
0
No votes yet

Gracias amigo. disculpa mi atrevimiento pero estoy un poco confundido serias tan amable de enviarme un ejemplo

edvan333
Offline
Joined: 2011-03-29
Rate this post:
0
No votes yet

gebop, he probado tus códigos pero hay algo que hace falta porque no enciende el lector y el html marca un "[object Error]", en realidad desconozco el nombre del archivo html. Revisando el código veo que nombras un archivo identify.asp, supongo que es el faltante para que funcione.

 

En realidad he buscado por todos lados y no encuentro nada en asp, en verdad me interesa mucho la respuesta, espero tus comentarios.

 

Alguien que me oriente?

tazcre
Offline
Joined: 2012-04-10
Rate this post:
0
No votes yet

Hola, yo obtengo el mismo error "[object Error]" lo pudiste resolver?

 

Gracias.

JB
Offline
Joined: 2010-09-15
Rate this post:
0
No votes yet

Estimado cliente,

 

Todas las máquinas tanto los clientes como el servidor tienen que tener el FP SDK instalado.

 

Jan

tazcre
Offline
Joined: 2012-04-10
Rate this post:
0
No votes yet

Todas las máquinas tanto el servidor como el cliente tienen instalado el SDK. Cómo puedo solucionar el problema?

 

Gracias

JB
Offline
Joined: 2010-09-15
Rate this post:
0
No votes yet

Estimado cliente,

 

Todos los permisos del ActiveX deben estar habilitados en el IE.

 

Jan

tazcre
Offline
Joined: 2012-04-10
Rate this post:
0
No votes yet

ya están todos los permisos habilitados

 

Gracias.

m.svol
Offline
Joined: 2010-09-02
Rate this post:
0
No votes yet

Dear customer,

Your support will continue on this other post: http://www.griaulebiometrics.com/en-us/forum/error-el-objeto-no-acepta-la-propiedad-o-el-m%C3%A9todo-initialize#comment-6358

Best regards,

 

--
Matheus Smythe Svolenski
Griaule Biometrics Support Team