Need help regards copy image to clipboard in website using ASP.Net or JavaScript?
<p>I need a help regards copy image to clipboard in website. The image is dynamically created one.</p>

<p>I found two solutions</p>

<p>Solution 1 : </p>

<pre><code>using System.Windows.Forms;

Bitmap bitmapImage ;

protected void buttonClipboard_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
    MemoryStream memoryStream = new MemoryStream(imageByteArray);             // Image byte array is the input
    bitmapImage = (Bitmap)System.Drawing.Image.FromStream(memoryStream);
    memoryStream.Flush();
    memoryStream.Close();
    Thread cbThread = new Thread(new ThreadStart(CopyToClipboard));
    cbThread.ApartmentState = ApartmentState.STA;
    cbThread.Start();
    cbThread.Join();
}

[STAThread]
protected void CopyToClipboard()
{
    if (bitmapImage != null)
    {
        //Clipboard.SetData(DataFormats.Bitmap, bitmapImage);
        Clipboard.SetImage(bitmapImage);
    }
}
</code></pre>

<p>This is working fine before publishing the website. 
After publishing this won't work in any website browsers because here STAThread used.
Some websites said thread won't work in published website due to internal multi-thread handling in browsers.</p>

<p>Solution 2 :   </p>

<pre><code>&lt;script type="text/javascript"&gt;
        function CopyToClip() {
            var imgControl = document.getElementById('imageContent');
            imgControl.contentEditable = 'true';
            var controlRange;
            if (document.body.createControlRange) {
                controlRange = document.body.createControlRange();
                controlRange.addElement(imgControl);
                controlRange.execCommand('Copy');
            }
            imgControl.contentEditable = 'false';
            return true;
        }
</code></pre>

<p></p>

<p>This java-script working fine for IE before &amp; after publishing website. But it is not working in Chrome &amp; Mozilla in any situation.</p>

<p>I need one solution for Mozilla &amp; Chrome.</p>

<p>Please suggest any solution for this? </p>
