PDF417 barcode does not display when pushing asp.net site to production server

25 views
Skip to first unread message

Doug Hamilton

unread,
Jun 8, 2017, 12:08:39 PM6/8/17
to zxing
I have a asp.net 4.0 app that I created using VS 2015. I am able to render my barcode when running in development mode, however, when I publish the application to the webserver that I am testing on, the image is coming up as a broken link.

I am wondering if there is an install or registration that I need to do for the ZXing dll's on the server.

Below is the code I am using for the Barcode handler.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing.Imaging;
using System.IO;
using System.Web;
using ZXing;
using ZXing.Common;
using ZXing.PDF417;


namespace InvoiceManager
{
/// <summary>
/// Summary description for BCHandler
/// </summary>
public class BCHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
//begin the 8 lines o' magic
string urlToQRify = context.Server.UrlDecode(context.Request.QueryString["u"].Replace("|", "&"));
var qrWriter = new BarcodeWriter();
qrWriter.Format = BarcodeFormat.PDF_417;
qrWriter.Options = new EncodingOptions() { Height = 125, Width = 1024, Margin = 0 };
//I like to make them large. You can resize them with CSS later
using (var bitmap = qrWriter.Write(urlToQRify))
{
using (var stream = new MemoryStream())
{
context.Response.ContentType = "image/jpeg";
bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}
}
}
catch
{

}
finally
{

}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}

2017-06-08 11_04_18-Start.png
2017-06-08 11_05_26-Separator Page - Internet Explorer.png
Reply all
Reply to author
Forward
0 new messages