As Solution 1 correctly tells you, you don't need to use
Invoke
in ASP.NET, but your problem is stemmed from the fact that you did not even know how and why to use it even in
System.Windows.Forms
, so you abused it. Please see my past answers:
Control.Invoke() vs. Control.BeginInvoke()[
^],
Problem with Treeview Scanner And MD5[
^].
In your ASP.NET case, you can simply remove redundant lines:
void Log(LogMsgType msgtype, string msg)
{
rtfTerminal.SelectedText = string.Empty;
rtfTerminal.SelectionFont = new Font(rtfTerminal.SelectionFont, FontStyle.Bold);
rtfTerminal.SelectionColor = LogMsgTypeColor[(int)msgtype];
rtfTerminal.AppendText(msg);
rtfTerminal.ScrollToCaret();
}
But, if this is really the logging, it is not a good solution. You need to learn about ASP.NET logging.
One widely used product is Apache log4net. Please see:
http://logging.apache.org/log4net/[
^].
This CodeProject article could be useful:
log4net Tutorial[
^].
—SA