I'm working on a web application using asp.net and c# in the code behind. I just want to copy a text in a textbox to clipboard, my code is as follow:
The problem is that this is working properly in debug mode, but when deploying my website, in running mode the CopyToClipboard is not working!
Thread newThread = new Thread(new ThreadStart(CopyToClipboard));
newThread.SetApartmentState(ApartmentState.STA);
newThread.Start();
private void CopyToClipboard()
{
Clipboard.Clear();
Clipboard.SetData("Text", txtEmailId.Text);
Clipboard.SetText(txtEmailId.Text);
}