I use ThoughtWorks.QRCode.dll, can be downloaded on the Internet, but pay attention to the integrity of the DLL file and accuracy, I downloaded the DLL is not correct to adjust the mistake.
The following are the CS file codes:
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingsystem.web;5 usingSystem.Web.UI;6 usingSystem.Web.UI.WebControls;7 usingThoughtworks.qrcode;8 usingThoughtWorks.QRCode.Codec;9 usingSystem.Drawing;Ten usingSystem.Text; One A namespacetwo code generation. Pages - { - Public Partial classCreateErWeiMa:System.Web.UI.Page the { - protected voidPage_Load (Objectsender, EventArgs e) - { - + } - + protected voidButton1_Click (Objectsender, EventArgs e) A { atThoughtworksqrcode ( This. TextBox1.Text); - - } - - Private voidThoughtworksqrcode (stringstrtxt) - { in Try - { to Bitmap bt; + stringEncodestring =Strtxt; -Qrcodeencoder Qrcodeencoder =NewQrcodeencoder (); theBT =Qrcodeencoder.encode (encodestring, Encoding.UTF8); * stringfilename = DateTime.Now.ToString ("YYYYMMDDHHMMSS");Panax Notoginsengfilename = filename. Replace (" ",""); -filename = filename. Replace (":",""); thefilename = filename. Replace ("-",""); +filename = filename. Replace (".",""); ABt. Save (Server.MapPath ("~/image/") + filename +". jpg"); the This. Image1.imageurl ="~/image/"+ filename +". jpg"; + } - Catch(Exception e) $ { $ Throwe; - } - the } - Wuyi } the}
C # generates two codes (Thoughtworks.qrcode)