locked
Magnetic Swipe Reader RRS feed

  • Question

  • User571357348 posted

    Hello Guys,

    I need some suggestion for below points,

    I have text box control in aspx page i need to ingrate Magnetic stripe card whenever user swipe card then i need to fetch card information and display on web page so how can i do this? 

    I need to implement on web page so how hardware can communicate with web page ?? 

    I don't know about this so please help for this

    Kindly Give Idea how to do this?

    Thanks In Advance

    Monday, August 31, 2020 5:05 AM

All replies

  • User475983607 posted

    mnh.asp

    I need to implement on web page so hardware communicate on web page ?? 

    Read the support documentation that codes with the reader.  Does the magnetic swipe reader work with a browser?  If not, you'll write interface code that makes an HTTP request to a URL when a card is swiped.  I assume the reader has an API.  Usually, the manufacturer has code examples that illustrates how to use the API. 

    Monday, August 31, 2020 11:54 AM
  • User571357348 posted

    Hii

    Thanks for  your reply

    The manufacturer give only console application for fetch data from card whenever some body card swipe

    it works correctly in my windows application because of SDK it I attach sample code pls check this is work in windows app i don't know how to implement on web page what should i do for this?

    using System;
    using System.Collections.Generic;
    using System.Text;

    using Desko.DDA;

    namespace DDevApiNETSample
    {
    static class OcrSample
    {
    public static void ReceiveOcrEvents()
    {
    try
    {
    // Init API to work with USB Swipe Reader only.
    DDALib.Initialize();
    DDADeviceManager.DeviceFilter = "^SR\\";

    // Create device object.
    using (DDADevice device = DDADeviceManager.CreateDevice("SR\\*"))
    {
    // Connect and activate device for reading
    device.Connect();
    device.OcrEvent += device_OcrEvent;
    device.PowerSaveMode = DDAPowerMode.Active;

    // Wait until key pressed
    Console.WriteLine("Wait for OCR event. Press any key to exit ...\n");
    ConsoleKeyInfo keyPressed = Console.ReadKey();

    // Let device sleep again
    device.PowerSaveMode = DDAPowerMode.Sleep;
    device.OcrEvent -= device_OcrEvent;
    }
    }
    catch (DDAException ex)
    {
    Console.WriteLine(ex.Message);
    }

    // Terminate API
    DDALib.Terminate();
    }

    static void device_OcrEvent(object sender, DDAOcrEventArgs args)
    {
    try
    {
    string ocr = Encoding.ASCII.GetString(args.Content);
    ocr = ocr.Replace("\r", "\n\r");

    Console.WriteLine("--- Ocr data --- ");
    Console.WriteLine("--- Index: " + args.Index);
    Console.WriteLine("--- Timestamp: " + args.Timestamp);
    Console.WriteLine("--- OCR: \n" + ocr);
    }
    catch (DDAException ex)
    {
    Console.WriteLine(ex.Message);
    }
    }
    }
    }

     Thanks In Advance

    Monday, August 31, 2020 12:20 PM
  • User753101303 posted

    Hi,

    The problem is that this code needs to run on the machine where the device is attached. Over the web I would expect a software that would insert the input information into the currently focused input text box (basically having the card reader emulating a keyboard). I noticed also once an USB API device in Chrome but I never tried.

    Don't they mention in their SDK if this device could be used from a web application?

    Edit: for example a product such as https://www.desko.de/cms-wAssets/docs/brochures/Brochure_DESKO_micro_OCR.pdf includes "Keyboard Emulation" in addition to a Windows and Android API. I would expect most if not all products to provide this as it is then usable in any app with no change.

    Monday, August 31, 2020 1:03 PM
  • User571357348 posted

    Hii

    No, They don't mention this SDK is used for web application

    This code is work for aspx page ? it works on it??

    Monday, August 31, 2020 1:19 PM
  • User475983607 posted

    No, They don't mention this SDK is used for web application

    This code is work for aspx page ? it works on it??

    The hardware must be ale to work with the browser not an ASPX page.  ASPX pages run on a web server not the client machine.  Browsers run on the client machine.

    If the reader is unable to write to the browser then you'll write code that gets installed on every client machine that uses the reader.

    Monday, August 31, 2020 1:32 PM
  • User753101303 posted

    The problem is that your C# code runs on the web server while the USB device is attached to the machine that runs the browser.

    If this product doesn't come with this "keyboard emulation" feature out of the box, you should be able to recreate this kind of tool by using their code in a Windows Forms application (or whatever you prefer for a desktop app) and then use something such as  https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netcore-3.1 to send that as keystrokes to the currently active application.

    Then your web app doesn't need to know anything about the reader. It will just show an input type="text" form field as usual to receive those keystrokes (and could use as well any other card reader having this feature out of the box).

    Edit: I don't have a card reader but used a timer to run SendKeys.Send("ABCD"); every 10 seconds and focused some input field on a random site and it worked.

    Monday, August 31, 2020 9:36 PM