Reshma Gurav

Reshma Gurav

  • 1.2k
  • 408
  • 32.7k

How to draw rectangle on image which is display using Image1.imgurl???

Feb 13 2012 1:01 AM

I display the images from my local disk using Image Control so i redirect user to another page for taking filename now i want to draw rectangle on image(image control).
so how to draw rectangle on image which is display using Image1.imgurl???

Default.aspx
Image1.ImageUrl = "ImageCSharp.aspx?FileName=" + file;

ImageCSharp.aspx

if (Request.QueryString["FileName"] != null)
  {
  string filePath = Session["fpath"].ToString() + @"\" ;
  string filename = Request.QueryString["FileName"];
  string contenttype = "image/" +      Path.GetExtension(filename).Replace(".", "");
  FileStream fs = new FileStream(filePath + filename, FileMode.Open, FileAccess.Read);
  BinaryReader br = new BinaryReader(fs);
  Byte[] bytes = br.ReadBytes((Int32)fs.Length);
  br.Close();
  fs.Close();

  //Write the file to response Stream
  Response.Buffer = true;
  Response.Charset = "";
  Response.Cache.SetCacheability(HttpCacheability.NoCache);
  Response.ContentType = contenttype;
  Response.AddHeader("content-disposition", "attachment;filename=" + filename);
  Response.BinaryWrite(bytes);
  Response.Flush();
  Response.End();


  }