0

My registration tool has a feature which allows candidates to load their personal information (like name, address, ..) from an ID.

When I compile the application with the build-in webserver in VS2010, and press the button to load ID information into textboxes, there is no problem. When I publish it on the localhost (with IIS), it crashes when I press the button.

This is what I received in my event viewer:

     0 
   APPCRASH 
   Not available 
   0 
   w3wp.exe 
   7.5.7601.17514 
   4ce7a5f8 
   KERNELBASE.dll 
   6.1.7601.17651 
   4e211319 
   e0434352 
   0000b9bc 

   0 
   7e796e20-f3e1-11e0-8ea3-60eb69b01829 
   0 

I'm working on a 64-bit laptop, use the Belgium Identity Card SDK.

Here you can find my code for the button;

        protected void Button1_Click(object sender, EventArgs e)
    {
        //READ eID
        ClearTextBoxes();
        try
        {
            BEID_ReaderSet ReaderSet;
            ReaderSet = BEID_ReaderSet.instance();

            BEID_ReaderContext Reader;
            Reader = ReaderSet.getReader();

            bool bCardPresent = Reader.isCardPresent();

            if (Reader.isCardPresent())
            {
                if (Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_EID
                    || Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_FOREIGNER
                    || Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_KIDS)
                {
                    try
                    {
                        Load_eid(Reader);
                    }
                    catch (Exception ex)
                    {
                        labelEx.Text = ex.Message;
                    }
                }
                else
                {
                    labelEx.Text = "No valid card, please insert a valid IDcard";
                }
            }

            else
            {
                labelEx.Text = "No IDcard found, please insert your card";
            }

            BEID_ReaderSet.releaseSDK();
        }

        catch (BEID_Exception ex)
        {
            BEID_ReaderSet.releaseSDK();
            labelEx.Text = "No valid cardreader found, please connect a valid reader";

        }

        catch (StackOverflowException ex)
        {
            BEID_ReaderSet.releaseSDK();
            labelEx.Text = "Error: " + ex;
        }

        catch (OutOfMemoryException ex)
        {
            BEID_ReaderSet.releaseSDK();
            labelEx.Text = "Error: " + ex;
        }
    }

        private void Load_eid(BEID_ReaderContext Reader)
    {
        try { 
        BEID_EIDCard card;
        card = Reader.getEIDCard();
        if (card.isTestCard())
        {
            card.setAllowTestCard(true);
        }

        BEID_EId doc;
        doc = card.getID();

        txtFirstN.Text = doc.getFirstName();
        txtLastN.Text = doc.getSurname();
        txtDOB.Text = doc.getDateOfBirth();

        //CUT GETSTREET IN STREET AND HOUSENO
        string street= doc.getStreet();
        string[] words = street.Split(' ');

        txtStreet.Text = words[0];
        txtHouseNo.Text = words[1];

        txtPostalCode.Text = doc.getZipCode();
        txtCity.Text = doc.getMunicipality();
        //sText += "Country = " + doc.getCountry() + "\r\n";

        }

        catch (Exception ex)
        {
            BEID_ReaderSet.releaseSDK();
            labelEx.Text = "Error: " + ex;
        }
    }

How can I solve this problem?

Thomas
  • 297
  • 1
  • 8
  • 21
  • 1
    You are executing this code on the server. So your card reader must be connected to the server. You are not identifying the person using the browser. (In your development environment, the client & server might be the same). – GvS Oct 11 '11 at 11:32

2 Answers2

1

Most likely your Application Pool is running under a user which does not have a privilege to access the card reader. This would cause a driver fault which can crash the w3wp.exe process.

Change it to a dedicated user and assign appropriate privileges for this user, or for testing purposes, set it to run under localsys.

Aliostad
  • 80,612
  • 21
  • 160
  • 208
  • could it not be the fact that i use a 32bit dll on a 64bit pc? I see in the documentation it is only compatible with win32. In my application pool, i've set the Enable 32-bit app to True – Thomas Oct 11 '11 at 11:59
  • 1
    That cannot explain you happily running it on your machine in VS. – Aliostad Oct 11 '11 at 12:06
  • how can i change it to a dedicated user and assign appropiate privileges, i'm quite new to IIS – Thomas Oct 11 '11 at 12:40
0

Move your code to Javascript (in the browser/html).

I don't think the IIS user has the permission to communicate with the ID reader API.

GvS
  • 52,015
  • 16
  • 101
  • 139
  • (how) can you grant permissions to communicate with the id reader api? – Thomas Oct 11 '11 at 11:40
  • Are you sure you want to use the ID-card reader on the server? It makes more sense to read the ID-card from the person using the browser. – GvS Oct 11 '11 at 11:42
  • it makes sense, but in the documentation of the Belgium Identity Card SDK they provided code for server side. I'm afraid that i have not enough time to build in javascript. But I will check out it later – Thomas Oct 11 '11 at 12:59
  • The example for Javascript is a bit hidden (page 39-43). The code for C# is used on Windows.Forms applications. Your solution now is fine if your users connect their reader directly to your server. – GvS Oct 11 '11 at 13:23