title: injecting a javascript code into a jpg image and execute the code when uploaded with c#
body: <p>I have recently been working in a security project and i have a task to demonstrate that javascript code injection can be done when the user upload an malicious image and this is a lack of security if it's not handled .
  what i did is i used <code>EXIFeditor</code> to inject the image with some javascript code and than i uploaded the image into the browser using this code </p>
  
  <pre><code> protected void Upload_File(object sender, EventArgs e)
  {
      var postedFile = Upload_fu.PostedFile;
      string fileName=new FileInfo(postedFile.FileName).Name;
      string path = Server.MapPath("~/images/" + fileName);
      postedFile.SaveAs(path);
      Success_msg.Text = "successfully saved";
      img_sr.ImageUrl = "~/images/" + fileName;
  }
  </code></pre>
  
  <p>Where <code>img_sr</code> is an <code>&lt;asp:Image</code> and <code>Upload_fu</code> is <code>&lt;asp:UploadFile</code> 
  the javascript code i've injected is a simple <code>alert("Hello world")</code>
  the problem is the code is not being executed. can u guys tell me how should i make it execute and can u show me some link that can give me a hint or something to make that happen .I tried it on firefox 21 and IE 9,I've posted my question in Infomation Security but no one answer ,I hope you guys can help .thank u </p>