We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is Aspose.BarCode supported to work in a Microsoft Azure web app resource?

Is Aspose.BarCode supported to work in a Microsoft Azure web app resource?


If so, How do I get Aspose.BarCode to create BarCodes in azure.

Everytime I try, i get the error message, "A generic error occurred in GDI+."

I looks like it is trying to write to the physical Azure Web App servers. (Which in-tern does not exists in Azure).

Any help will be helpful here.

Timothy Murray

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.7px Verdana; color: #800000; -webkit-text-stroke: #800000} span.s1 {font-kerning: none}
Hi Timothy,

Thank you for your inquiry.

This is to update you that we need sample code that you are using with MS Azure. This will help us to reproduce the issue at our end. Please forward us the sample code. We will investigate the issue and with update you about our findings via this forum thread.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; color: #5b5b5b; -webkit-text-stroke: #5b5b5b; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; color: #5b5b5b; -webkit-text-stroke: #5b5b5b; background-color: #ffffff; min-height: 12.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px Consolas; -webkit-text-stroke: #000000; background-color: #ffffff} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px Consolas; -webkit-text-stroke: #000000; background-color: #ffffff; min-height: 11.0px} p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px Consolas; color: #0433ff; -webkit-text-stroke: #0433ff; background-color: #ffffff} p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; color: #333333; -webkit-text-stroke: #333333; background-color: #ffffff} p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px Consolas; color: #0069d9; -webkit-text-stroke: #0069d9; background-color: #ffffff} span.s1 {font-kerning: none} span.s2 {font-kerning: none; color: #ff2600; -webkit-text-stroke: 0px #ff2600} span.s3 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000} span.s4 {text-decoration: underline ; font-kerning: none; -webkit-text-stroke: 0px #0069d9}

Here is the code I you requested:


public class FileManager

{

private string _barCodeFolderPath = "/Content/images/BarCodes/";

public string BarCodeFolderPath

{

get { return _barCodeFolderPath; }

}


public string CreateBarCode(string barcodeString, int coversheetId)

{

string barcodeSavePath = HttpContext.Current.Server.MapPath("~" + this._barCodeFolderPath + coversheetId.ToString() + ".gif");


BarCodeBuilder barcodeBuilder = new BarCodeBuilder();


barcodeBuilder.CodeText = barcodeString;


barcodeBuilder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Code128;


barcodeBuilder.xDimension = 1f;


barcodeBuilder.Save(barcodeSavePath, System.Drawing.Imaging.ImageFormat.Gif);


return _barCodeFolderPath + coversheetId + ".gif";


}

}


According to a different post, you guys said,


"We just found out that the exception occurred due to security restrictions. The IUSR_MachineName should have write access on the directory where you want to save the image files."


Source:

the question is how do I do that in an Azure Environment.


if it cannot be done in Azure, then the only other solution I can think of is:


Does ASP.Barcode have an other way of Render a Barcode images without having to write a image file to the server.



Hi Timothy,

Thank you for sharing sample code.

This is to update you that issue needs investigation. The issue has been logged into our system with ID BARCODENET-36377 for investigation. Information that you shared has been forwarded to our product team. Our product team will further look into it. We will update you about the progress via this forum thread.

Furthermore the referred forum link is very old. On additional notes, you can save the barcode image to a stream.
Hi Timothy,

Please modify your code in the following way and try it at your. Feel free to reach us in case of any query or comments.

CODE:

public string CreateBarCode(string barcodeString, int coversheetId)
{
string barcodeSavePath = HttpContext.Current.Server.MapPath("~" + this._barCodeFolderPath + coversheetId.ToString() + ".gif");
using( BarCodeBuilder barcodeBuilder = new BarCodeBuilder())
{
barcodeBuilder.CodeText = barcodeString;
barcodeBuilder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Code128;
barcodeBuilder.xDimension = 1f;
barcodeBuilder.Save(barcodeSavePath, System.Drawing.Imaging.ImageFormat.Gif);
}
return _barCodeFolderPath + coversheetId + ".gif";
}