This example illustrates how you can use our new Bar Code Library in ASP.NET to generate and display a barcode image on the webpage. The best approach implies creating a custom HTTP Handler that will generate and output an image. Here is a code of this handler:
[C#]publicclassBarCodeHandler:IHttpHandler{publicvoidProcessRequest(HttpContextcontext){BarCodebarCode=newBarCode();barCode.Symbology=Symbology.QRCode;barCode.CodeText="123";context.Response.ContentType="image/png";barCode.Save(context.Response.OutputStream,ImageFormat.Png);context.Response.End();}publicboolIsReusable{get{returnfalse;}}}
The img tag in the main aspx page is defined as follows:
[ASPx]<imgsrc="BarCodeHandler.ashx"alt="QRCode"width="200px"height="200px"/>
See Also:
HTTP-handler for image
The Universal Subscription or an additional Document Server Subscription is required to use this example in production code. Please refer to the DevExpress Subscription page for pricing information.
Question Comments
Added By: ABRAMO ABRAMO at: 6/14/2013 2:12:48 AM
I get Server Error in '/E4716' Application when I click "Run Online"