Displaying image using Image control in button click event
<p>I am creating image comparison (images exists in directory) web based application. It compares images exists in particular directory with provided image. It compares each image with matching percentage but not displaying images from related directory even i have given the image url to that images also. When i write response.write then it shows matching percentage with that matching image, but not displaying images.
I have written code for that as follows :</p>

<pre><code>     protected void btnnew_Click(object sender, EventArgs e)
       {

           Bitmap searchImage;
           try
           {
//Image for comparing other images that are exists in directory             
searchImage = new Bitmap(@"D:\kc\ImageCompare\Images\img579.jpg");
           }
           catch (ArgumentException)
           {
               return;
           }

           string dir = "D:\\kc\\ImageCompare\\Images";

         DirectoryInfo dir1 = new DirectoryInfo(dir);
           FileInfo[] files = null;
           try
           {
               files = dir1.GetFiles("*.jpg");
           }
           catch (DirectoryNotFoundException)
           {
               Console.WriteLine("Bad directory specified");
               return;
           }

           double sim;
           foreach (FileInfo f in files)
           {
               sim = Math.Round(GetDifferentPercentageSneller(searchImage, new Bitmap(f.FullName)), 3);
               if (sim &gt;= 0.95)
               {
                   Image1.ImageUrl = dir + files[0];
                   Image2.ImageUrl = dir + files[1];

                   Response.Write("Perfect match with Percentage" + " " + sim + " " + f);
                   Response.Write("&lt;/br&gt;");

               }
               else
               {
                   Response.Write("Not matched" + sim);

               }

           }
       }
</code></pre>
