Apply to Asp.net 3.5

Jul 17, 2008 at 3:57 PM
Hello, I am trying to use this on an ASP.Net 3.5 web page. I have followed the code and I understand it more or less. However, when I try to make a Web page using the code, i get stucked. Basically, the first part that I need is to read the DNI.dni property at the begining and then represent it on the screen. I put the Main code in the source codeinto the load event of my web page (with the proper changes) but it thinks there is no smart card inserted. here is the code:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using PlainConcepts.Fx.Dnie.DigitalSign;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //Helper de trabajo con el dni
            PlainConcepts.Fx.Dnie.DnieHelper dniHelper = new PlainConcepts.Fx.Dnie.DnieHelper();

            // Verificamos si la smart card esta presente
            // esto hace que salte la ventana de insercion de smartCard, la terminacion
            // de este método se produce cuando se inserta la smart card y se hace click en OK
            // o cuando se cancela la ventana
            if (dniHelper.IsSmartCardPresent())
            {
                //Una vez introducida al pedir la identidad saltará la
                //ventana de introduzcion de la contraseña del dni
                PlainConcepts.Fx.Dnie.DnieIdentity dni = dniHelper.GetIdentity();
                //Console.WriteLine(dni.FirstName.ToString());
                //Console.WriteLine(dni.LastName.ToString());
                this.Label1.Text=dni.Dni.ToString();

                //
                // En la seccion de configuracion se pueden establecer los tipos
                // que realizan la firma para cada una de las extensiones, es un sistema de plugins,
                // el requisito es que estos tipos implementen la interfaz publica PlainConcepts.Fx.Dnie.DigitalSign.IDigintalSigner
                // y tengan un constructor por defecto
                // Una vez creado y empaquetado el tipo debe establecerse en la seccion de configuracion DniE, en este
                // ejemplo esta configurado un plugin para firmar xml

                //
                //Firmamos un documento xml
                //dniHelper.SignDocument(@".\test.xml", @".\test2.xml");
                //Console.WriteLine("Documento firmado correctamente...");
            }
            else
                this.Label1.Text=("Ha rechazado la introduccion de la smart card");

        }
        catch (Exception ex)
        {
            this.Label1.Text=(ex.Message);
        }
    }
}


Can any one help me with this?? Thanks a lot.
Jul 18, 2008 at 9:50 AM
Edited Jul 18, 2008 at 10:39 AM
Hello.

I have found the problem. THe problem was that the program was not recognizing the PlainCocepts.SmartCard.dll. I put it on the root folder. When I moved it to the bin folder, it worked perfectly. However, I have another problem. It works while executing the application on the IDE of Visual Studio, but when I try to execute it going directly to the IE, it fails.
I think this my be something related with permission to binfolder, but I have used impersonation, cofigure a user who belong to admin group  in IIS, and give full permissions to binfolder to that group/user (which I dont like, just to try) but still the problem appears.

Any ideas what s going on with PlainCocepts.SmartCard.dll?

Thanks a lot
Jun 8, 2009 at 11:29 AM

Please, mister, any solution about it ??

thanks !!!