Hi,
I've problem using AsposeBarcode to retrieve barcode image from memory stream.
I create 1 aspx page called GenerateBarcode.aspx which receive querystring "code". Then this page is generating barcode image on the fly using httphandler.
Below is the code :
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["code"] != null)
{
Response.Clear();
BarCodeBuilder bb = new BarCodeBuilder();
bb.CodeText = decodeString(Request.QueryString["code"].ToString());
bb.ImageWidth = 255;
bb.ImageHeight = 50;
bb.BarHeight = 40;
bb.CaptionBelow.Visible = false;
bb.CodeLocation = Aspose.BarCode.CodeLocation.None;
bb.ImageUnit = System.Drawing.GraphicsUnit.Pixel;
bb.SymbologyType = Symbology.Code128;
System.IO.MemoryStream mStream = new System.IO.MemoryStream();
bb.BarCodeImage.Save(mStream, System.Drawing.Imaging.ImageFormat.Jpeg);
if (BA2.Services.Caching.Get(bb.CodeText) == null)
{
BA2.Services.Caching.Add(bb.CodeText, mStream);
}
bb.GenerateBarCodeImage();
System.IO.MemoryStream cachedStream = (System.IO.MemoryStream)BA2.Services.Caching.Get(bb.CodeText);
Response.ContentType = "image/jpeg";
cachedStream.WriteTo(Response.OutputStream);
}else
{
Response.ContentType = "text/html";
Response.Write("
Need a valid Batch ID
");}
}
I tried to implement this in my dotnetnuke module. In my module, i called this page using
When i executed the dnn, my image doesn't show up, it only shows "X" image indicating the image isn't loaded successfully. Then I also notice that this caused all of my session suddenly destroyed.
Anyone know how is this happen?
Thanks