I have a WPF class file (.DLL) which opens a webbrowsercontrol and returns some value.
I have used this as a reference in an ASP.NET website ... but i get the below error when the code hits the webbrowsercontrol.
The calling thread must be STA, because many UI components require this.
I looked all over, but i cannot seem to use [STAThread] or Dispatcher. Could someone please help me get around this ? here is the code.
WPFClass is the DLL file referenced.
using WPFClass;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
WPFClass.Browser Nav = new WPFClass.Browser();
string response = Nav.Open();
TextBox1.Text = response;
}
}