32 Comments

QR Code on a buildingHave you ever seen QR codes? QR means Quick Response. It’s has a Japanese origin. Created by Toyota initially to track car parts during manufacturing.

These days it’s getting more popular each day because of the mobile internet and the increase of maturity among mobile operating systems. Almost each mobile operating system has one or several QR Code scanners enabling the consumer to ‘mobile tag’.

[more]

 

Here is a simple workflow of mobile tagging:

 

Workflow of Mobile Tagging

Now there is this old post from 2007 about a .Net QRCode library here: http://twit88.com/home/opensource/qrcode 

But I have found this updated and extended version here:

http://twit88.com/platform/projects/show/mt-qrcode

Their last update is from 18 April 2010. So I grabbed their 1.1.0.0 version and installed it.

After installation I copied the DLL MessagingToolkit.QRCode.dll from

C:\Program Files (x86)\MessagingToolkit\MessagingToolkit-QRCode\QRCode\

to my Bin directory of my Asp.Net C# project and referenced it. Please note that the DLL is quite large; it’s over 6 MB.

Now you can generate a tag easily with:

string yoururl = "http://www.jphellemons.nl";
MessagingToolkit.QRCode.Codec.QRCodeEncoder qe = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
System.Drawing.Bitmap bm = qe.Encode(yoururl);

 

I made an handler (.ashx) for it so that I can get QR codes by placing this html

<img src="GetQRCode.ashx?code=abcdefghijk" alt="the code" />

on my website and use the following in my ashx:

public void ProcessRequest (HttpContext context) {
    string prodCode = context.Request.QueryString.Get("code");
    context.Response.ContentType = "image/gif";
    if (prodCode.Length > 0)
    {
        MessagingToolkit.QRCode.Codec.QRCodeEncoder qe = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
        System.Drawing.Bitmap bm = qe.Encode("http://www.yourdomain.com/product.aspx?code=" + prodCode);
        bm.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
    }   
}

The possibilities are endless now that you can generate QR codes. You can provide the marketing department of QR codes which they can embed on posters they spread on the streets enabling customers to scan and go to your specific offer landings page.

Happpy mobile tagging!


kick it on DotNetKicks.com Shout it

 

Calvin Klein's QR Code in New York

Edit 12 April 2012: I have received an email from Reynoldo who told me that the twit88.com website is down. So you can download the DLL here now, it's almost 6mb: MessagingToolkit.QRCode.dll (5.91 mb)

Edit 18 April 2012: The 1.3.0 package is now available on NuGet

Post on LinkedIn