Generating Bar Code In ASP.Net

Generating Bar code
 
install OnBarcode.Barcode;
 
C# Code
 
On the button click event 
  1. protected void btnGenerateCode_Click(object sender, EventArgs e)  
  2. {  
  3.     Linear barcode = new Linear();  
  4.     //barcode.Type = BarcodeType.CODE128A;  
  5.     barcode.Data = txtBarcode.Text;  
  6.     barcode.ShowText = true;  
  7.              
  8.     Random rd = new Random();  
  9.     string path = Server.MapPath("~/Images/" + txtBarcode.Text + ".png");  
  10.     barcode.drawBarcode(path);  
  11.     imgBarcode.ImageUrl ="~/Images/" + txtBarcode.Text + ".png";  
  12.     txtBarcode.Text = "";  
    }